Versions.props 7.4 KB
Newer Older
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- Copyright (c)  Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information. -->
3
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4

5 6 7 8
  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
  </PropertyGroup>

T
Tomas Matousek 已提交
9 10
  <Import Project="RepoToolset\GitHash.props" />
 
11
  <!-- This controls the version numbers of the build that we are producing -->
12

13
  <PropertyGroup>
14
    <!-- This is the assembly version of Roslyn from the .NET assembly perspective. It should only be revved during significant point releases. -->
J
Jared Parsons 已提交
15
    <RoslynAssemblyVersionBase Condition="'$(RoslynAssemblyVersion)' == ''">2.8.0</RoslynAssemblyVersionBase>
16
    <!-- This is the file version of Roslyn, as placed in the PE header. It should be revved during point releases, and is also what provides the basis for our NuGet package versioning. -->
J
Jared Parsons 已提交
17
    <RoslynFileVersionBase Condition="'$(RoslynFileVersionBase)' == ''">2.8.0</RoslynFileVersionBase>
J
Jared Parsons 已提交
18 19 20
    <!-- The release moniker for our packages.  Developers should use "dev" and official builds pick the branch
         moniker listed below -->
    <RoslynNuGetMoniker Condition="'$(RoslynNuGetMoniker)' == ''">dev</RoslynNuGetMoniker>
21 22
    <!-- PROTOTYPE(dataflow) This needs to be reverted before merging to master -->
    <RoslynNuGetMoniker Condition="'$(OfficialBuild)' == 'true'">dataflow</RoslynNuGetMoniker> 
23

24
    <!-- This is the base of the NuGet versioning for prerelease packages -->
J
Jared Parsons 已提交
25
    <NuGetPreReleaseVersion>$(RoslynFileVersionBase)-$(RoslynNuGetMoniker)</NuGetPreReleaseVersion>
26

27
    <!-- We should not be signing a build anywhere except for in MicroBuild, which will always specify 'BUILD_BUILDNUMBER'-->
28
    <BuildNumber Condition="'$(BuildNumber)' == ''">$(BUILD_BUILDNUMBER)</BuildNumber>
29
    <Error Condition="'$(BuildNumber)' == '' AND '$(OfficialBuild)' == 'true'">A build number must be specified for a signed build.</Error>
30

31 32 33 34
    <!-- When a build number is not specified, then we should default back to '00065535.0', which is a build number in the
         same format as provided by MicroBuild v2, but greater than any that MicroBuild v2 will produce, and is still compatible
         with the Win32 file version limitations. This is required so that builds done locally, where '$(OfficialBuild)' == 'true',
         can still be deployed to VS and override the version that is globally installed. -->
35 36 37 38 39
    <BuildNumberFiveDigitDateStamp Condition="'$(BuildNumber)' == ''">65535</BuildNumberFiveDigitDateStamp>
    <BuildNumberBuildOfTheDayPadded Condition="'$(BuildNumber)' == ''">01</BuildNumberBuildOfTheDayPadded>
  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildNumber)' != ''">
40
    <!-- When a build number is specified, it needs to be in the format of 'x.y'-->
41
    <Error Condition="$(BuildNumber.Split($([System.Convert]::ToString(`.`).ToCharArray())).Length) != 2">BuildNumber should have two parts (in the form of 'x.y')</Error>
42

43
    <!-- Split the build parts out from the BuildNumber which is given to us by MicroBuild in the format of yyyymmdd.nn
44
         where BuildNumberFiveDigitDateStamp is mmmdd (such as 60615) and BuildNumberBuildOfTheDay is nn (which represents the nth build
45
         started that day). So the first build of the day, 20160615.1, will produce something similar to BuildNumberFiveDigitDateStamp: 60615,
46 47 48
         BuildNumberBuildOfTheDayPadded: 01;and the 12th build of the day, 20160615.12, will produce BuildNumberFiveDigitDateStamp: 60615, BuildNumberBuildOfTheDay: 12

         Additionally, in order ensure the value fits in the 16-bit PE header fields, we will only take the last five digits of the BuildNumber, so
49 50 51 52 53
         in the case of 20160615, we will set BuildNumberFiveDigitDateStamp to 60615. Further, if this would result in a number like 71201 or 81201, we
         decrement the year and add 12 to the month to extend the time. -->
    <BuildNumberFiveDigitDateStamp>$([MSBuild]::Subtract($(BuildNumber.Split($([System.Convert]::ToString(`.`).ToCharArray())).GetValue($([System.Convert]::ToInt32(0)))), 20100000))</BuildNumberFiveDigitDateStamp>
    <_BuildNumberFiveDigitDateStampYearsToOffset>$([System.Math]::Max($([System.Convert]::ToInt32($([MSBuild]::Subtract($([MSBuild]::Divide($(BuildNumberFiveDigitDateStamp), 10000)), 6)))), 0))</_BuildNumberFiveDigitDateStampYearsToOffset>
    <BuildNumberFiveDigitDateStamp>$([MSBuild]::Subtract($([System.Convert]::ToInt32($(BuildNumberFiveDigitDateStamp))), $([MSBuild]::Multiply($(_BuildNumberFiveDigitDateStampYearsToOffset), 8800))))</BuildNumberFiveDigitDateStamp>
54
    <BuildNumberBuildOfTheDayPadded>$(BuildNumber.Split($([System.Convert]::ToString(`.`).ToCharArray())).GetValue($([System.Convert]::ToInt32(1))).PadLeft($([System.Convert]::ToInt32(2)), $([System.Convert]::ToChar(`0`))))</BuildNumberBuildOfTheDayPadded>
55
  </PropertyGroup>
J
Jared Parsons 已提交
56

57
  <PropertyGroup>
J
Jared Parsons 已提交
58 59 60
    <!-- NuGet version -->
    <NuGetReleaseVersion>$(RoslynFileVersionBase)</NuGetReleaseVersion>
    <NuGetPerBuildPreReleaseVersion>$(NuGetPreReleaseVersion)-$(BuildNumberFiveDigitDateStamp)-$(BuildNumberBuildOfTheDayPadded)</NuGetPerBuildPreReleaseVersion>
61
    <NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == ''">$(NUGET_PACKAGES)</NuGetPackageRoot> <!-- Respect environment variable if set -->
62 63
    <NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' AND '$(OS)' == 'Windows_NT'">$(UserProfile)/.nuget/packages/</NuGetPackageRoot>
    <NuGetPackageRoot Condition="'$(NuGetPackageRoot)' == '' AND '$(OS)' != 'Windows_NT'">$(HOME)/.nuget/packages/</NuGetPackageRoot>
64
    <NuGetPackagesDirectory>$(NuGetPackageRoot)</NuGetPackagesDirectory>
65
  </PropertyGroup>
66

67
  <Choose>
68
    <When Condition="'$(OfficialBuild)' == 'true' OR '$(UseShippingAssemblyVersion)' == 'true'">
69
      <PropertyGroup>
70 71 72
        <AssemblyVersion>$(RoslynAssemblyVersionBase).0</AssemblyVersion>
        <BuildVersion>$(RoslynFileVersionBase).$(BuildNumberFiveDigitDateStamp)</BuildVersion>
        <VsixVersion>$(RoslynFileVersionBase).$(BuildNumberFiveDigitDateStamp)$(BuildNumberBuildOfTheDayPadded)</VsixVersion>
73 74 75 76 77
      </PropertyGroup>
    </When>

    <Otherwise>
      <!-- No build version was supplied.  We'll use a special version, higher than anything
78 79 80 81
           installed, so that the assembly identity is different.  This will allows us to
           have a build with an actual number installed, but then build and F5 a build with
           this number. We will make AssemblyVersion and BuildVersion different, to catch
           any bugs where people might assume they are the same. -->
82 83
      <PropertyGroup>
        <AssemblyVersion>42.42.42.42</AssemblyVersion>
84 85
        <BuildVersion>42.42.42.42424</BuildVersion>
        <VsixVersion>42.42.42.42424</VsixVersion>
86 87 88
      </PropertyGroup>
    </Otherwise>
  </Choose>
89

T
Tomas Matousek 已提交
90 91 92 93 94 95 96 97 98 99
  <PropertyGroup>
    <!-- On non-official builds we don't burn in a git sha.  In large part because it
         hurts our determinism efforts as binaries which should be the same between
         builds will not (due to developers building against different HEAD
         values). -->
    <CommitHashDisplay>&lt;developer build&gt;</CommitHashDisplay>
    <CommitHashDisplay Condition="'$(OfficialBuild)' == 'true'">$(GitHeadSha)</CommitHashDisplay>
    
    <InformationalVersion>$(NuGetPerBuildPreReleaseVersion). Commit Hash: $(CommitHashDisplay)</InformationalVersion>
  </PropertyGroup>
100
</Project>