-
Notifications
You must be signed in to change notification settings - Fork 12
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
Change request: A way to conditionally disable MSBuildGitHash #26
Comments
An easy way to do this would be to add a condition to the PackageReference:
This raising an interesting point though. This package should include proper build logic to avoid a full rebuild if the repository version is unchanged. I'll have to think about how to best achieve that, which might take me a while to get to. In the mean time I hope the above workaround is sufficient for you. |
It doesn't work in VS 17 & VS 19 (see https://stackoverflow.com/questions/48590270/packagereference-condition-is-ignored) <Choose>
<When Condition=" '$(Configuration)' != 'Debug' ">
<ItemGroup>
<PackageReference Include="MSBuildGitHash">
<Version>2.0.2</Version>
</PackageReference>
</ItemGroup>
</When>
</Choose> Unfortunatelly it is not compatible with Manage NuGet packages VS UI. It doesn't see the package. And I hope that when I will manage another packages, this workaround will not be broken. So I would like to have some conditional property like MSBuildGitHashValidate that can disable the package. |
Also with this workaround when installing new package VS tries to remove MSBuildGitHash if current config is Debug. Any chances for fix? |
I'm probably not going to make any further changes to this package as there is a better way to do this now . The .NET project system and MSBuild have changed significantly since I created this package, and trying to keep up with those changes is difficult. Fortunately, some of those changes have made it easier to do this without needing a nuget package. See the update that I provided to this SO answer: This new technique is what I've been using for my projects, and I'm happier with it than I was with needing this custom package. |
AddSourceRevisionToInformationalVersion/SourceRevisionId awesome undocumented something. It still looks like MS Build magic :) |
I want to disable MSBuildGitHash in Debug config because it increases compilation time, but useless in debug for me.
Also it seems that project may rebuild because of MSBuildGitHash even if nothing changed in the project.
For example when I edit tests main project also recompiled even if it wasn't changed.
The text was updated successfully, but these errors were encountered: