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

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?

Related

What Nuget Package do I need for WinApplication.GetSecurityStrategy().RegisterXPOAdapterProviders();?

I created a new Winforms Xaf Xpo standard security project with 21.2/5
Then I changed the framework of each project to be 4.7.2
Then I ran the upgrade wizard.
Then I tried to convert the project files to use Nuget with Package References.
However I get the following build errors
Severity Code Description Project File Line Suppression State
Error CS1061 'SecurityStrategy' does not contain a definition for 'RegisterXPOAdapterProviders' and no accessible extension method 'RegisterXPOAdapterProviders' accepting a first argument of type 'SecurityStrategy' could be found (are you missing a using directive or an assembly reference?) DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\Program.cs 33 Active
Error CS0246 The type or namespace name 'SecuredObjectSpaceProvider' could not be found (are you missing a using directive or an assembly reference?) DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\WinApplication.cs 20 Active
I tried drilling into another new project and I can see that RegisterXPOAdapterProviders has namespace DevExpress.ExpressApp.Security
I already have that installed as a NugetPackage.
I tried installing DevExpress.ExpressApp.Security.Xpo but I get a message
Severity Code Description Project File Line Suppression State
Error NU1101 Unable to find package DevExpress.ExpressApp.Persistent.Base. No packages exist with this id in source(s): DevExpressMy, nuget.org, SBDCommonFeed#Local DXXpo.Win C:\Users\kirst\source\repos\DXXpo\DXXpo.Win\DXXpo.Win.csproj 1
There are no packages starting with DevExpress.ExpressApp.Persistent in the feed.
The docs are here
This question is possibly related.
I managed to resolve this issue by including the package DevExpress.ExpressApp.Security.Xpo

C# Error CS0234 even after adding aspnetcore and extensions packages

I have a C# code that I am trying to run on VS Code. The steps I went through are as follows:
create folder (for this case we will name it "Program") for the program files and then run
dotnet new console
Replace the Program.cs file inside the "Program" folder with the Program.cs file I intend to run ( I did this with earlier C# applications and it worked)
Run the following commands to add packages:
dotnet add package aspnetcore
dotnet add package extensions
All packages above were installed successfully
I ran the command
dotnet build
but received the following errors:
error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
Please tell me how I am to resolve this issue. Thank you
I implemented the solution by Jon Skeet , where I created a new folder and then used the command
dotnet new web
and managed to create a new ASP.NET Core project, complete with all the necessary libraries and links.
Thanks guys
I then transferred the files and folders I needed into this new folder and

NuGet Packages claiming to not be correctly installed

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.

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.

"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.

Categories

Resources