GitTools / GitVersion

From git log to SemVer in no time
https://gitversion.net/docs/
MIT License
2.85k stars 650 forks source link

UpdateAssemblyInfo target should not be run for SDK-style projects #2182

Closed bording closed 4 years ago

bording commented 4 years ago

The UpdateAssemblyInfo target is currently always being run, even for SDK-style projects that don't need it. The SDK-style project system handles that automatically as long as the appropriate properties have been set. This is already happening in the GetVersion target.

This behavior used to work correctly, and you can even see a comment in the GitVersionTask.props file indicating that this was the behavior.

This appears to have been broken in the 5.0.0 release, but fixing #2167 in 5.2.3 brought it to my attention because that change broke one of my projects.

Expected Behavior

The UpdateAssemblyInfo target should not be run when using an SDK-style project.

Actual Behavior

The UpdateAssemblyInfo target should not be run when using an SDK-style project.

Possible Fix

Add a condition to the UpdateAssemblyInfo property in GitVersionTask.props that disables the UpdateAssemblyInfo when the UsingMicrosoftNETSdk property is true.

Steps to Reproduce

Context

I have an SDK-style project that is using the MSBuild.Sdk.Extras SDK to build a WPF app, and using 5.2.3 is causing a build error because of duplicate version attributes from GitVersion trying to create them instead of letting the project system do it.

arturcic commented 4 years ago

@bording is this related or duplicate of https://github.com/GitTools/GitVersion/issues/2181

bording commented 4 years ago

@arturcic It's definitely related, but I'm not sure I'd call it a duplicate. Looks like #2181 is reporting a symptom of the regression that I'm reporting here.

github-actions[bot] commented 4 years ago

:tada: This issue has been resolved in version 5.2.4 :tada: The release is available on:

Your GitReleaseManager bot :package::rocket: