NuGet Packages claiming to not be correctly installed - c#

I have a project that references
WindowsAzure.ServiceBus
However, when I rebuild the project, I get the error:
1>C:\Users\xyz\documents\visual studio
2017\Projects\MyProject\Class.cs(1,17,1,27): error
CS0234: The type or namespace name 'ServiceBus' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
1>C:\Users\xyz\documents\visual studio
2017\Projects\MyProject\Class.cs(12,24,12,38): error
CS0246: The type or namespace name 'EventHubClient' could not be found
(are you missing a using directive or an assembly reference?)
I've removed and restored the packages directory for the solution, but to no avail. I've tried re-installing the NuGet packages:
Update-Package -reinstall
Which claimed to successfully restore the package. I can Build the project successfully, but a Rebuild fails. Issuing an MSBuild in the command prompt also fails.
Just to alay any theories that there's no using statement, Class.cs:
using Microsoft.ServiceBus.Messaging;
I'm at a loss to how to progress with this; can anyone offer any ideas where to go next?

Posting for the points :) (I love them)
Other thing that comes to my mind is to Upgrade your .NET Framework version. If nuget dll was build for higher .NET runtime, there is just a Warning message printed in Output window and Error window stays clear. But Build fails.

Related

How can I solve the missing Office Reference when building on DevOps?

I'm trying to compile a c# project on azure DevOPS but I get this error on the Build Solution step of the pipeline:
##[error]AddColumnLSCT\MainWindow.xaml.cs(3,22): Error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
If I try to locally build the project it works correctly without any error or warnings.
I've already added the Microsoft.Office.Interop.Excel as you can see in the attached image
References, and the corresponding NuGet Package as you can see in this attached image NuGet Packages. How can i fix this?

Upgrade MS VS2013 to MS VS2015 Error CS0234 The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft'

Both Question and Solution included here.
When opening a Microsoft Windows Application MS VS2013 C# Professional in MS VS2015 C# Professional, the following error displayed:
Error CS0234 The type or namespace name 'Reporting' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
In VS2015, under Solution Explorer, under References, for Microsoft.ReportViewer.Common and Assembly Microsoft.ReportViewer.WinForms, the paths were missing under their Properties. The paths are not editable.
To solve this problem, under References, delete Microsoft.ReportViewer.Common and Assembly Microsoft.ReportViewer.WinForms. Then re-add these references (found under Extensions). The paths were automatically entered, and the compiling errors disappeared.
The best way to include the Microsoft ReportViewer control in your project is to install it via the NuGet package manager. It should keep track of the references and their paths automatically.

Teamcity is unable to download the NuGet Selenium WebDriver package

We are attempting to run our Selenium tests on TeamCity after build.
It appears as though the Selenium.WebDriver reference isn't downloaded by TeamCity. Here's the output of our build:
SeleniumTests.cs(3, 7): error CS0246: The type or namespace name 'OpenQA' could not be found (are you missing a using directive or an assembly reference?)
SeleniumTests.cs(4, 7): error CS0246: The type or namespace name 'OpenQA' could not be found (are you missing a using directive or an assembly reference?)
SeleniumTests.cs(11, 9): error CS0246: The type or namespace name 'PhantomJSDriver' could not be found (are you missing a using directive or an assembly reference?)
Each of these references are inside the Selenium.WebDriver package.
All of the other NuGet references: NUnit.Runners and NUnit are resolved by TeamCity perfectly fine (NuGet package restore appears to be working).
NuGet will automatically resolve the packages and run the tests fine on my local computer.
I tried removing the Selenium.WebDriver NuGet package from the project. This causes the exact same error, so it appears as though the package is never downloaded.
Does anyone have any suggestions?
Update: the Seleinum WebDriver package has 2 files: a dll and an xml. TeamCity was downloading the xml but not the dll. I manually copied the dll from my computer into the packages folder on the TeamCity server and our tests ran. I'll leave this open for anyone to answer why only some of the files were downloaded with NuGet.

"The type or namespace name 'OfficeOpenXml' could not be found" error

We are using EPPlus to generate Excel documents. Code builds successful in my local system but it is failing when we build through TeamCity and getting below error -
error CS0246: The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)
I have tried Google to find the solution but all in vain. My Project target framework is 4.5.2 and I have also added System.Core and WindowsBase. I have also added namespace "using OfficeOpenXml"
EPPlus is added through Nuget Package.
If you have any packages installed using NuGet, then you need to add a NuGet Installer build step in your build configuration before the actual build command, using the solution file which references the NuGet packages you need. This step is what causes TeamCity to download any NuGet packages that are required that it doesn't have installed.
I solved it by removing and add EPPlus reference manually.

The type or namespace name 'Core' does not exist in the namespace

I encounter this kind of error when I debug a project
I already have EntityFramework.dll, System.Core.dll, System.Data.Entity but still Core is not referenced.
Can someone help me?
I'm having error in this Line
using System.Data.Entity.Core.Objects;
This is the error:
The type or namespace name 'Core' does not exist in the namespace 'System.Data.Entity' (are you missing an assembly reference?)
Enrique, I had this problem crop up when I started opening a project on my desktop that I had normally been opening on my VM. Masoud's answer is not helpful... I don't think he read your original post.
What I did to clear this compile error up was to open NuGet package manager and install the update that was available for EntityFramework. I had version 6.1.1 installed in the project and I upgraded to 6.1.3. I should not have had the error to start with, but upgrading the version appeared to jiggle whatever it was loose because I started compiling fine after that.
Sometimes, when you add references from other sources than nuget manager (example: Local source) you need to verify the HintPath of that reference before moving your application in another environment

Categories

Resources