I am getting CS0579 errors from my TFS automated build system. The same build script works fine on my development machine. Build is also successful in Visual Studio. The project is that is erroring is C# netcoreapp3.1 and platform x64
ERROR: Tests.AssemblyInfo.cs(15,12): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
Error is repeated for several other attributes:
Am I missing something on my build agent? What could be going on?
Edit: I should have mentioned that there is no AssemblyInfo.cs in the project and that false property is already set in the csproj.
Also, as mentioned above the build script has been run successfully on my workstation. Subsequently it has also been run successfully on another dev workstation. But, fails consistently on the TFS build agent.
The error CS0579: Duplicate 'System.Reflection.xxx' attribute
always indicates that there're extra AssenvlyVersion available in your build process.
1.So you need to check if you pass MSbuild arguments like /p:Version /p:AssemblyVersion
as build arguments.
2.Make sure you're using Dotnet build task
to build the project.
3.Double check to make sure you don't have any xx.AssemblyInfo.cs
in project directory.
4.Make sure the bin/obj
folder are not checked in source control. Then delete the agent_work
folder or _work
folder of your build agent to make a clear working directory. Choose Clean=true
for your Get Source
step.