Skip to content

Commit f75e275

Browse files
committed
Update versioning targets to match other aspnet OOB projects
1 parent 444abde commit f75e275

5 files changed

Lines changed: 55 additions & 41 deletions

tools/CosmosDBSessionStateProviderAsync.settings.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup>
4-
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
4+
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
5+
<!-- See MicrosoftAspNetSessionState.settings.targets for default version settings. -->
56
<VersionMajor>2</VersionMajor>
67
<VersionMinor>1</VersionMinor>
78
<VersionRelease>0</VersionRelease>

tools/MicrosoftAspNetSessionState.settings.targets

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,18 @@
1515
<!-- Configurable properties-->
1616

1717
<PropertyGroup>
18-
<!-- Versioning:
19-
Major: 'Major' for Assembly, File, Info, and Package.
20-
Minor: 'Minor' for Assembly, File, Info, and Package.
21-
Build: Third (auto-generated) for File and Info. (Assembly is always 0)
22-
Revision: 'Revision' for Assembly and File. Strategy - Try to leave this 0 and only rev Major/Minor for big changes and Release for non-dependency-breaking changes.
23-
Release: Third for Info and Package.
24-
Update package and file without touching assembly, except for major releases.
25-
26-
Most of the interesting ones are already set in each project's individual settings file.
18+
<!-- Versioning - Different than .Net's Version(Major.Minor.Build.Revision):
19+
1) Major: 'Major' for Assembly, File, Info, and Package.
20+
2) Minor: 'Minor' for Assembly, File, Info, and Package.
21+
3a) Revision: Third for Assembly and File. Strategy - Try to leave this 0 and only rev Major/Minor for big changes and Release for non-dependency-breaking changes.
22+
3b) Release: Third for Info and Package.
23+
4) Build: (Auto-generated) for File and Info. (Assembly is always 0)
24+
Update package and file without touching assembly, except for major releases.
25+
26+
Most of the interesting ones are already set in each project's individual settings file.
2727
-->
2828
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
2929
<VersionStartYear Condition="'$(VersionStartYear)' == ''">2025</VersionStartYear>
30-
<VersionMajor Condition="'$(VersionMajor)' == ''">2</VersionMajor>
31-
<VersionMinor Condition="'$(VersionMinor)' == ''">1</VersionMinor>
32-
<VersionRevision Condition="'$(VersionRevision)' == ''">0</VersionRevision>
33-
<VersionRelease Condition="'$(VersionRelease)' == ''">0</VersionRelease>
34-
<VersionBuild Condition="'$(VersionBuild)' == '' OR '$(VersionBuild)' == '0'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
35-
<NuGetPackageVersion>$(VersionMajor).$(VersionMinor).$(VersionRelease)</NuGetPackageVersion>
36-
</PropertyGroup>
37-
38-
<!-- Add release type for non-RTM releases. -->
39-
<PropertyGroup Label="Prerelease version adjustments" Condition="'$(BuildQuality)' != 'rtm'">
40-
<NuGetPackageVersion>$(NuGetPackageVersion)-$(BuildQuality)</NuGetPackageVersion>
41-
</PropertyGroup>
42-
43-
<!-- Additionaly, add date stamp to 'preview' releases. -->
44-
<PropertyGroup Label="Prerelease version adjustments" Condition="'$(BuildQuality)' == 'preview'">
45-
<NuGetPackageVersion>$(NuGetPackageVersion)$(VersionBuild)</NuGetPackageVersion>
4630
</PropertyGroup>
4731

4832
<!-- Default properties -->

tools/SessionStateModule.settings.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup>
4-
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
4+
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
5+
<!-- See MicrosoftAspNetSessionState.settings.targets for default version settings. -->
56
<VersionMajor>2</VersionMajor>
67
<VersionMinor>1</VersionMinor>
78
<VersionRelease>0</VersionRelease>

tools/SqlSessionStateProviderAsync.settings.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project DefaultTargets="UnitTest" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup>
4-
<BuildQuality Condition="'$(BuildQuality)' == ''">preview1</BuildQuality>
4+
<!-- Update version in config.xdt's for major/minor changes. (Don't update for 'release' changes.) -->
5+
<!-- See MicrosoftAspNetSessionState.settings.targets for default version settings. -->
56
<VersionMajor>2</VersionMajor>
67
<VersionMinor>1</VersionMinor>
78
<VersionRelease>0</VersionRelease>

tools/version.targets

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,49 @@ Project global versioning targets.
99
<!-- NOTE: The VersionFileAttribute ItemGroup can be used to add assembly-level attributes to the generated version file, ex:
1010
<VersionFileAttribute Include="[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(&quot;Microsoft.Usage&quot;, &quot;CA2243:AttributeStringLiteralsShouldParseCorrectly&quot;, Justification = &quot;Justification here&quot;)]" />
1111
-->
12-
1312
<PropertyGroup>
1413
<VersionFileGenerationEnabled Condition="'$(VersionFileGenerationEnabled)' == '' AND '$(MSBuildProjectExtension)' == '.csproj'">true</VersionFileGenerationEnabled>
1514
<VersionFileGenerationEnabled Condition="'$(VersionFileGenerationEnabled)' == ''">false</VersionFileGenerationEnabled>
1615
</PropertyGroup>
1716

17+
<!-- Versioning - Different than .Net's Version(Major.Minor.Build.Revision):
18+
1) Major: 'Major' for Assembly, File, Info, and Package.
19+
2) Minor: 'Minor' for Assembly, File, Info, and Package.
20+
3a) Revision: Third for Assembly and File. Strategy - Try to leave this 0 and only rev Major/Minor for big changes and Release for non-dependency-breaking changes.
21+
3b) Release: Third for Info and Package.
22+
4) Build: (Auto-generated) for File and Info. (Assembly is always 0)
23+
Update package and file without touching assembly, except for major releases.
24+
25+
Most of the interesting ones are already set in each project's individual settings file.
26+
-->
1827
<PropertyGroup>
19-
<VersionStartYear Condition="'$(VersionStartYear)' == ''">2019</VersionStartYear>
28+
<_PreventVSPropertyCaching>$([System.DateTime]::Now.Ticks)</_PreventVSPropertyCaching>
29+
<VersionStartYear Condition="'$(VersionStartYear)' == ''">INVALID_VersionStartYear</VersionStartYear>
2030
<VersionMajor Condition="'$(VersionMajor)' == ''">INVALID_VersionMajor</VersionMajor>
2131
<VersionMinor Condition="'$(VersionMinor)' == ''">INVALID_VersionMinor</VersionMinor>
22-
<VersionBuild Condition="'$(VersionBuild)' == '' OR '$(VersionBuild)' == '0'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
2332
<VersionRevision Condition="'$(VersionRevision)' == ''">0</VersionRevision>
2433
<VersionRelease Condition="'$(VersionRelease)' == ''">0</VersionRelease>
34+
<VersionBuild Condition="'$(VersionBuild)' == ''">0</VersionBuild>
35+
<VersionBuild Condition="'$(VersionBuild)' == '0' AND '$(VersionStartYear)' != 'INVALID_VersionStartYear'">$([MSBuild]::Add(1, $([MSBuild]::Subtract($([System.DateTime]::Now.Year), $(VersionStartYear)))))$([System.DateTime]::Now.ToString("MMdd"))</VersionBuild>
2536
</PropertyGroup>
2637

2738
<!-- Comptued parameters -->
2839

2940
<PropertyGroup>
30-
<AssemblyVersion>$(VersionMajor).$(VersionMinor).0.$(VersionRevision)</AssemblyVersion>
31-
<AssemblyFileVersion>$(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision)</AssemblyFileVersion>
32-
<AssemblyInfoVersion Condition="'$(VersionRelease)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)-$(VersionBuild)</AssemblyInfoVersion>
33-
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == ''">$(AssemblyFileVersion)</AssemblyInfoVersion>
41+
<_PreventVSPropertyCaching2>$([System.DateTime]::Now.Ticks)</_PreventVSPropertyCaching2>
42+
<AssemblyVersion>$(VersionMajor).$(VersionMinor).$(VersionRevision).$(VersionBuild)</AssemblyVersion>
43+
<AssemblyFileVersion>$(VersionMajor).$(VersionMinor).$(VersionRevision).$(VersionBuild)</AssemblyFileVersion>
44+
<AssemblyInfoVersion>$(VersionMajor).$(VersionMinor).$(VersionRelease)-$(VersionBuild)</AssemblyInfoVersion>
3445
<AssemblyVersionFile>$(IntermediateOutputPath)$(MSBuildProjectName).version.cs</AssemblyVersionFile>
35-
</PropertyGroup>
36-
37-
<PropertyGroup>
46+
<SatelliteContractVersion Condition="'$(SatelliteContractVersion)' == ''">$(AssemblyVersion)</SatelliteContractVersion>
3847
<NuGetPackageVersion Condition="'$(NuGetPackageVersion)' == ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)</NuGetPackageVersion>
3948
</PropertyGroup>
4049

41-
<PropertyGroup>
42-
<SatelliteContractVersion Condition="'$(SatelliteContractVersion)' == ''">$(AssemblyVersion)</SatelliteContractVersion>
50+
<PropertyGroup Label="Add prerelease tag to non-rtm releases" Condition="'$(BuildQuality)' != 'rtm'">
51+
<NuGetPackageVersion>$(NuGetPackageVersion)-$(BuildQuality)</NuGetPackageVersion>
52+
</PropertyGroup>
53+
<PropertyGroup Label="Add date-stamp to 'preview' releases" Condition="'$(BuildQuality)' == 'preview'">
54+
<NuGetPackageVersion>$(NuGetPackageVersion)$(VersionBuild)</NuGetPackageVersion>
4355
</PropertyGroup>
4456

4557
<ItemGroup Condition="'$(VersionFileGenerationEnabled)' == 'true'">
@@ -71,7 +83,22 @@ Project global versioning targets.
7183
</PropertyGroup>
7284
<Target Name="GenerateVersionFile" DependsOnTargets="$(GenerateVersionFileDependsOn)" />
7385

74-
<Target Name="GenerateVersionFileCore" Condition="'$(ShouldGenerateVersionFile)' == 'true'">
86+
<Target Name="EnsureGitInfo" Condition="'$(GitCommit)' == ''">
87+
<Exec Command="git describe --match= --always --dirty --abbrev=40" ConsoleToMSBuild="true" IgnoreExitCode="false" ContinueOnError="true" >
88+
<Output PropertyName="GitDescribeOutput" TaskParameter="ConsoleOutput" />
89+
<Output PropertyName="GitDescribeExit" TaskParameter="ExitCode" />
90+
</Exec>
91+
<PropertyGroup Condition="'$(GitDescribeExit)' == '0'">
92+
<GitCommit>$(GitDescribeOutput)</GitCommit>
93+
</PropertyGroup>
94+
</Target>
95+
96+
<Target Name="GenerateVersionFileCore" Condition="'$(ShouldGenerateVersionFile)' == 'true'" DependsOnTargets="EnsureGitInfo">
97+
<PropertyGroup>
98+
<AssemblyInfoVersion Condition="'$(GitCommit)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)+$(GitCommit)</AssemblyInfoVersion>
99+
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == '' AND '$(VersionBuild)' != ''">$(VersionMajor).$(VersionMinor).$(VersionRelease)-$(VersionBuild)</AssemblyInfoVersion>
100+
<AssemblyInfoVersion Condition="'$(AssemblyInfoVersion)' == ''">$(AssemblyFileVersion)</AssemblyInfoVersion>
101+
</PropertyGroup>
75102
<ItemGroup>
76103
<LinesToWrite Include="// $(SourceFileCopyright)" Condition="'$(SourceFileCopyright)' != ''"/>
77104
<LinesToWrite Include="// &lt;auto-generated&gt;" />

0 commit comments

Comments
 (0)