Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Duplicate attributes with MSBuild task in WPF net5.0-windows project #2805

Closed
arp-mbender opened this issue Aug 12, 2021 · 6 comments
Closed
Labels

Comments

@arp-mbender
Copy link

arp-mbender commented Aug 12, 2021

Describe 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

  1. Create a new .NET 5 WPF project (net5.0-windows)
  2. Ensure that the new project is using GIT, i.e. create at least a local GIT repo
  3. Install GitVersion.MsBuild Nuget
  4. Ensure no version information is provided inside the project (a new project shouldn't have any information)
  5. 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

@arp-mbender arp-mbender changed the title [Bug] Duplicate attributes with MSBuild task in net5.0-windows project [Bug] Duplicate attributes with MSBuild task in WPF net5.0-windows project Aug 12, 2021
@arp-mbender
Copy link
Author

arp-mbender commented Aug 12, 2021

I think I know what's going on - the MSBuild task isn't compatible with net5.0-windows...? I'm honestly not sure however.

@asbjornu
Copy link
Member

Seems like a duplicate of #2512, #2278, #2226, #2163 and #1802.

@Crown0815
Copy link

@arp-mbender maybe try this

@arp-mbender
Copy link
Author

Seems like a duplicate of #2512, #2278, #2226, #2163 and #1802.

Yup, that might be the case. I think updating the documentation on using GitVersion might in order to cull down on such questions. ;)

@asbjornu
Copy link
Member

@arp-mbender, agreed. I just don't use the MSBuild task myself, so I wouldn't know what to document. If you or anyone else using the MSBuild task can provide the necessary documentation to alleviate problems like this, we would highly appreciate a pull request. 🙏🏼 The documentation resides in the docs directory of this very repository.

@asbjornu
Copy link
Member

#2841 resolved this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants