-
Notifications
You must be signed in to change notification settings - Fork 217
/
Directory.Build.props
41 lines (33 loc) · 2.15 KB
/
Directory.Build.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<ContinuousIntegrationBuild Condition="$(Configuration) == 'Release'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration) == 'Debug'">
<!-- workaround for https://github.com/dotnet/sdk/issues/37027 -->
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
</ItemGroup>
<PropertyGroup Label="Version">
<VersionPrefix Condition="$(VersionPrefix) == ''">1.0.2</VersionPrefix>
</PropertyGroup>
<PropertyGroup Label="Version" Condition="$(VersionLabel) != ''">
<_VersionLabel>$(VersionLabel.Replace('refs/heads/', ''))</_VersionLabel>
<_VersionLabel>$(_VersionLabel.Replace('refs/tags/v', ''))</_VersionLabel>
<!-- For PRs, we just need a fixed package version numbered after the PR # itself, so remove the commits # at the end -->
<_VersionLabel Condition="$(_VersionLabel.Contains('refs/pull/'))">$(VersionLabel.TrimEnd('.0123456789'))</_VersionLabel>
<!-- Next replace the prefix for simply 'pr', so we end up with 'pr99/merge' by default -->
<_VersionLabel>$(_VersionLabel.Replace('refs/pull/', 'pr'))</_VersionLabel>
<!-- Remove the /merge now, if present -->
<_VersionLabel>$(_VersionLabel.Replace('/merge', ''))</_VersionLabel>
<!-- Finally sanitize the branch with dashes, so we can build path-separated branches, like rel/v1.0.0 or feature/foo -->
<_VersionLabel>$(_VersionLabel.Replace('/', '-'))</_VersionLabel>
<!-- Set sanitized version to the actual version suffix used in build/pack -->
<VersionSuffix Condition="!$(VersionLabel.Contains('refs/tags/'))">$(_VersionLabel)</VersionSuffix>
<!-- Special case for tags, the label is actually the version. Backs compat since passed-in value overrides MSBuild-set one -->
<Version Condition="$(VersionLabel.Contains('refs/tags/'))">$(_VersionLabel)</Version>
</PropertyGroup>
</Project>