Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Error CS0246 encountered in DevOps build pipeline, but not when building in Visual Studio

$
0
0

The project I'm trying to build is a class library that creates a NuGet package. In the project file, I'm targeting .NET Standard 2.0 and .NET 4.6.1.

This project builds perfectly on my local machine using Visual Studio 2019, and creates NuGet packages for both target frameworks. However, when I run the build pipeline for it in Azure DevOps, I encounter the following error:

##[error]MyCompany.MyProject\Properties\AssemblyInfo.cs(6,12): Error CS0246: The type or namespace name 'AssemblyTitleAttribute' could not be found (are you missing a using directive or an assembly reference?)

The build pipeline is just running the solution file through csc.exe. Aside from the references, this is the command line:

csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;RELEASE;NETFRAMEWORK;NET461;NET20_OR_GREATER;NET30_OR_GREATER;NET35_OR_GREATER;NET40_OR_GREATER;NET45_OR_GREATER;NET451_OR_GREATER;NET452_OR_GREATER;NET46_OR_GREATER;NET461_OR_GREATER /highentropyva+

I did learn that an AssemblyInfo.cs file was being automatically generated and only existed in memory. To verify that, I looked in my repo and, sure enough, there was no such file in the repo. So I created one in the Properties folder, and modified the .csproj file as follows:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>netstandard2.0;net461</TargetFrameworks><GenerateAssemblyInfo>false</GenerateAssemblyInfo></PropertyGroup>

However, the same error occurs when I run the pipeline.

At this point, I have no idea how to resolve this issue. I've searched Google far and wide and can't seem to come up with a solution for it that seems applicable (aside from what I've already tried.)

Help me, StackOverflow. You're my only hope.


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>