-
Notifications
You must be signed in to change notification settings - Fork 654
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
Inject into correct point in build pipeline for VS 2017 #1119
Conversation
Related to this in terms of making it easier to extend the |
I've made a few updates:
|
e71e0c6
to
5083cad
Compare
@onovotny: Is this backwards compatible with VS2015? |
It should be, it adds a few properties that weren’t in or used before and takes an additional “or” dependency on a couple of targets that weren’t there before either.
…Sent from my Windows 10 phone
From: Asbjørn Ulsberg<mailto:notifications@github.com>
Sent: Friday, December 30, 2016 3:09 PM
To: GitTools/GitVersion<mailto:GitVersion@noreply.github.com>
Cc: Oren Novotny<mailto:oren@novotny.org>; Mention<mailto:mention@noreply.github.com>
Subject: Re: [GitTools/GitVersion] Inject into correct point in build pipeline for VS 2017 (#1119)
@onovotny<https://github.com/onovotny>: Is this backwards compatible with VS2015?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#1119 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABXHVKepabBZ33J6-pcJnrlYKQ6KCEVqks5rNWTlgaJpZM4LNomU>.
|
Any news on this? I have a new VS2017 RC project cross-targeting <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net40;net45</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="4.0.0-beta0009" />
</ItemGroup>
<!-- ... --> The compile failes because of duplicate
|
@thoemmi The fix to that is to remove those attributes from your AssemblyInfo file. That file is ideally completely generated now anyway by attributes in the csproj. |
@onovotny Wisecracker 😉 Of course I already would have done that if there were an AssemblyInfo file. Anyway, I think I can manage to create the correct version information. My current .csproj looks like this <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net40;net45</TargetFrameworks>
<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitVersionTask" Version="4.0.0-beta0009" />
</ItemGroup>
<Target Name="UpdateVersionVars" AfterTargets="GetVersion">
<Message Text="$(GitVersion_SemVer)" Importance="High" />
<PropertyGroup>
<FileVersion>$(GitVersion_AssemblySemVer)</FileVersion>
<AssemblyVersion>$(GitVersion_AssemblySemVer)</AssemblyVersion>
<PackageVersion>$(GitVersion_SemVer)</PackageVersion>
<InformationalVersion>$(GitVersion_SemVer)</InformationalVersion>
</PropertyGroup>
</Target>
<!-- ... --> The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
<GetVersion Condition=" '$(GetVersion)' == '' ">true</GetVersion> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove multiple empty lines
@@ -79,9 +79,8 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Include="app.config" /> | |||
<None Include="NugetAssets\GitVersionTask.targets"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the file NugetAssets\GitVersionTask.targets be deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was moved into the build folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed this :)
<UpdateAssemblyInfo Condition=" '$(UpdateAssemblyInfo)' == '' ">true</UpdateAssemblyInfo> | ||
|
||
<!-- Property that enables setting of Version --> | ||
<UpdateVersionProperties Condition=" '$(UpdateVersionProperties)' == '' ">true</UpdateVersionProperties> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if these properties can be documented here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will update the docs now
dbd8ada
to
4f88796
Compare
I've added docs - I think I've covered it? |
@onovotny Thanks LGTM. I'll merge it as soon as the build has passed. |
Once GitVersion supports CoreCLR and linux/mac, we can include a .net core version of these as well. I think LibGit2Sharp has that support now? I think NerdBank.GitVersioning is using that and he has a coreclr task. |
@onovotny It's merged now. Thanks for your contribution! |
This is an initial attempt at implementing the .NET Desktop side of #1118.
Notably, it's a bit "whack a mole" in terms of ensuring the
GetVersion
target is executed early enough. Then, without trying to overwrite what the user wants, the user will have to add something like this into their project file in order to copy the generated values into the correct version variables:Copying to
Version
at that stage will ensure that theAssemblyFileVersion
andAssemblyVersion
are set based on thatVersion
turns into the informational version. I'm not sure if you can use theFullSemVer
there or if that'll cause the parsing to barf.... either way, the user is in control of what variables they assign to what there.If there's a better way to do this than to have the user supply an
AfterTargets
, then I'm all for it. I tested this locally and it did correctly generate the file/assembly versions and the package version when using the pack command.