TGY
TGY

Reputation: 331

.NET CORE build results in Duplicate Errors in vscode

I am just trying to understand the whole build/publish topic for .NET Core and was playing around with one basic console application.

When I build the app

dotnet build

and afterwards build it with release configuration

dotnet build --configuration Release

I receive errors saying

Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [test]

obviously the files

./obj/Debug/netcoreapp2.1/test.Assembly.info

and

./obj/Release/netcoreapp2.1/test.Assembly.info

store values for the same attributes:

enter image description here

What am I doing wrong?

Some further questions to get a clearer picture of this:

I've read all the documentation from ms but imo its from and for people more familiar with building processes.

Thank you very much in advance

Upvotes: 11

Views: 9691

Answers (1)

In short, setting GenerateAssemblyInfo to false in the relevant .csproj should do the trick:

 <PropertyGroup>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>

See this git-issue

And this one

Short explanation: .NET CORE first introduced the project.json based project system, which replaced AssemblyInfo.cs. Later, project.json was dropped in favor of a more extensive .csproj usage. Read more here

Upvotes: 18

Related Questions