[Bug] Duplicate attributes with MSBuild task in WPF net5.0-windows project
See original GitHub issueDescribe the bug After installing the MSBuild GitVersion task and removing all version information the project fails to compile due to duplicate version attribute errors.
Build output:
Build started...
1>------ Build started: Project: WpfApp1, Configuration: Debug Any CPU ------
1>C:\Users\mbender\Desktop\WpfApp1\WpfApp1\obj\Debug\net5.0-windows\WpfApp1_0fxhewp2_wpftmp.AssemblyInfo.cs(16,12,16,58): error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
1>C:\Users\mbender\Desktop\WpfApp1\WpfApp1\obj\Debug\net5.0-windows\WpfApp1_0fxhewp2_wpftmp.AssemblyInfo.cs(17,12,17,67): error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
1>C:\Users\mbender\Desktop\WpfApp1\WpfApp1\obj\Debug\net5.0-windows\WpfApp1_0fxhewp2_wpftmp.AssemblyInfo.cs(20,12,20,54): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute
1>Done building project "WpfApp1_0fxhewp2_wpftmp.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Expected Behavior
Following the basic tutorial I’d expect the project to compile and have GitVersion-calculated version information applied.
Actual Behavior
Project fails to compile.
Possible Fix
No clue.
Steps to Reproduce
- Create a new .NET 5 WPF project (net5.0-windows)
- Ensure that the new project is using GIT, i.e. create at least a local GIT repo
- Install GitVersion.MsBuild Nuget
- Ensure no version information is provided inside the project (a new project shouldn’t have any information)
- Attempt to compile the project
Context
Cannot use GitVersion in my project.
Your Environment
Windows Server 2019 Standard GIT 2.32.0.windows.2 VS 2019 GitVersion.MsBuild 5.6.11
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
WPF application build fails with "Program does not contain ...
WPF application build fails with "Program does not contain a static 'Main' method" using MSBuild from SDK 6.0 instead of bundled MSBuild in ......
Read more >MSBuild reference for .NET Desktop SDK projects
Reference for the MSBuild properties and items that are understood by the .NET Desktop SDK, which includes WPF and WinForms.
Read more >CS0579 Duplicate Attribute Error with .NET Core
The error is a result of the build process generating AssemblyInfo.cs files in each project obj directory. This file exists to provide MSBuild...
Read more >Net 5 library projects have incorrect configuration
When create a Windows Forms Class Library or WPF Class library, the target framework displays: net5.0-windows. Which project template did ...
Read more >Making a WPF app using a SDK-style project with ...
NET Core SDK that adds missing MSBuild targets and properties to enable building project types that are not supported out of the box....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@arp-mbender maybe try this
Seems like a duplicate of #2512, #2278, #2226, #2163 and #1802.