I am developing a web application which started life by running dotnet new angular
(Clear blog explanation of usage).
To extend the functionality of the default code I started developing a Web API. I added 3 new .Net Core Library Projects named Shared
, Scheduling
and Scheduling_Tests
.
Some Domain Model classes were defined in Scheduling
, some base classes were defined in Shared
and finally some NUnit tests were defined in ShedulingTests
.
When I build the Solution, 2 new folders appear in my Web Application project: Shared
and Scheduling
. I also get build errors like the following:
Error CS0579 Duplicate 'System.Reflection.AssemblyCompanyAttribute'
I'm not sure where to go with this one, any advise would be very welcome.
This happens because the new .NET tools automatically create the attributes and add them to the assembly, so they now appear twice in the build.
There are two ways to fix it:
Delete AssemblyInfo.cs
Keep AssemblyInfo.cs, but add tags to your CSProj file to suppress the attributes in AssemblyInfo.
For example:
<PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> </PropertyGroup>
(Thanks to https://johnkoerner.com/csharp/dealing-with-duplicate-attribute-errors-in-net-core/)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With