DotNet Debugging CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute
I am working on a SDK where we have multiple build targets. I have been running into an issue where each of the targets seems to be building assembly attributes when I have explicitly turned them off with
<TargetFramework>netstandard2.0</TargetFramework> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <AssemblyName>Dropbox.Api</AssemblyName> <RootNamespace>Dropbox.Api</RootNamespace> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute> <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
In the main property group of every csproj file
Here is the errors I am seeing:
net45obj\Debug.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘global::System.Runtime. Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk- dotnet\dropbox-sdk-dotnet\Dropbox.Api\ Dropbox.Api.NetStandard.csproj] net45obj\Release.NETFramework,Version=v4.5.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘global::System.Runtim e.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk- dotnet\dropbox-sdk-dotnet\Dropbox.Ap i\Dropbox.Api.NetStandard.csproj] portable40obj\Debug.NETPortable,Version=v4.0,Profile=Profile344.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘ global::System.Runtime.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk-dotnet\dropbox- sdk-dotnet\Dropbox.Api\Dropbox.Api.NetStandard.csproj] portable40obj\Release.NETPortable,Version=v4.0,Profile=Profile344.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘global::System.Runtime.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk-dotnet\dropbo x-sdk-dotnet\Dropbox.Api\Dropbox.Api.NetStandard.csproj] portableobj\Debug.NETPortable,Version=v4.5,Profile=Profile111.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘gl obal::System.Runtime.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk-dotnet\dropbox-sd k-dotnet\Dropbox.Api\Dropbox.Api.NetStandard.csproj] portableobj\Release.NETPortable,Version=v4.5,Profile=Profile111.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘ global::System.Runtime.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk-dotnet\dropbox- sdk-dotnet\Dropbox.Api\Dropbox.Api.NetStandard.csproj] obj\Release\netstandard2.0.NETStandard,Version=v2.0.AssemblyAttributes.cs(4,12): error CS0579: Duplicate ‘global::Syst em.Runtime.Versioning.TargetFrameworkAttribute’ attribute [dropbox-sdk- dotnet\dropbox-sdk-dotnet\D ropbox.Api\Dropbox.Api.NetStandard.csproj]
I am not sure if I am generating this incorrectly or if there is another way to disable this error. For more information, I am working on the Dropbox SDK
Did you tried to set GeneratePackageOnBuild
to false
?
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
But first delete all of these assembly attributes files