|
35 | 35 | <MSBuildGitHashValueStart Condition="$(MSBuildGitHashValue.Length) <= 32">$(MSBuildGitHashValue)</MSBuildGitHashValueStart> |
36 | 36 | <MSBuildGitHashValueStart Condition="$(MSBuildGitHashValue.Length) > 32">$(MSBuildGitHashValue.Substring(0,32))</MSBuildGitHashValueStart> |
37 | 37 | <MSBuildGitHashRegexMatch>$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildGitHashValue), $(MSBuildGitHashValidateRegex)))</MSBuildGitHashRegexMatch> |
| 38 | + </PropertyGroup> |
38 | 39 |
|
| 40 | + <PropertyGroup Condition="'$(UsingMicrosoftNETSdk)' == 'true'"> |
39 | 41 | <!-- |
40 | 42 | SourceRevisionId is used by the Microsoft.NET.GenerateAssemblyInfo to populate |
41 | 43 | the AssemblyInformationalVersion, this only happens in SDK builds. |
42 | 44 | --> |
43 | | - <SourceRevisionId |
44 | | - Condition="'$(SourceRevisionId)' == '' And '$(UsingMicrosoftNETSdk)' == 'true' And '$(IncludeMSBuildGitHashInfoVersion)' == 'true'" |
| 45 | + <SourceRevisionId |
| 46 | + Condition="'$(SourceRevisionId)' == '' And '$(IncludeMSBuildGitHashInfoVersion)' == 'true'" |
45 | 47 | >$(MSBuildGitHashValue)</SourceRevisionId> |
46 | 48 | </PropertyGroup> |
47 | 49 |
|
48 | | - <Error |
| 50 | + <PropertyGroup Condition="'$(UsingMicrosoftNETSdk)' == 'true' And '$(MSBuildGitHashReplaceInfoVersion)' == 'True'"> |
| 51 | + <!-- suppress the sdk handling of informational version when MSBuildGitHashReplaceInfoVersion is set --> |
| 52 | + <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> |
| 53 | + <InformationalVersion>$(MSBuildGitHashValue)</InformationalVersion> |
| 54 | + </PropertyGroup> |
| 55 | + |
| 56 | + <Error |
49 | 57 | Condition="'$(MSBuildGitHashValidate)' == 'True' And ($(MSBuildGitHashValueLength) > $(MSBuildGitHashValidateLength) Or '$(MSBuildGitHashRegexMatch)' != 'True')" |
50 | 58 | Text="MSBuildGitHash hash value starting with '$(MSBuildGitHashValueStart)' was invalid." |
51 | 59 | /> |
|
54 | 62 |
|
55 | 63 | <Target |
56 | 64 | Name="GenerateAssemblyVersionAttributes" |
57 | | - Condition="'$(UsingMicrosoftNETSdk)' != 'true'" |
| 65 | + Condition="'$(UsingMicrosoftNETSdk)' != 'True'" |
58 | 66 | DependsOnTargets="GetGitHash" |
59 | 67 | > |
60 | 68 | <PropertyGroup> |
61 | 69 | <MSBuildGitHashVersionAttribute>$(Version)+$(MSBuildGitHashValue)</MSBuildGitHashVersionAttribute> |
62 | | - <MSBuildGitHashVersionAttribute Condition="$(MSBuildGitHashReplaceInfoVersion) == 'True'">$(MSBuildGitHashValue)</MSBuildGitHashVersionAttribute> |
| 70 | + <MSBuildGitHashVersionAttribute Condition="'$(MSBuildGitHashReplaceInfoVersion)' == 'True'">$(MSBuildGitHashValue)</MSBuildGitHashVersionAttribute> |
63 | 71 | </PropertyGroup> |
64 | 72 |
|
65 | 73 | <ItemGroup> |
|
70 | 78 | </AssemblyAttributes> |
71 | 79 | </ItemGroup> |
72 | 80 | </Target> |
73 | | - |
| 81 | + |
74 | 82 | <Target |
75 | 83 | Name="GenerateAssemblyAttributes" |
76 | 84 | DependsOnTargets="GetGitHash" |
|
0 commit comments