Skip to content

Commit 2ac4619

Browse files
authored
Replace custom targets for generating assembly attributes and source control info by using SDK features (#7504)
1 parent 06d7fe7 commit 2ac4619

31 files changed

+155
-105
lines changed

.azure/pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
jobDisplayName: "Build: Linux Musl x64"
264264
agentOs: Linux
265265
buildScript: ./dockerbuild.sh alpine
266-
buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch x64 --os-name linux-musl --no-build-nodejs --no-build-java -p:RepositoryBranch=$(Build.SourceBranchName)
266+
buildArgs: --ci --pack --all -e KOREBUILD_SKIP_INSTALL_NETFX=0 --arch x64 --os-name linux-musl --no-build-nodejs --no-build-java
267267
installNodeJs: false
268268
afterBuild:
269269
# Remove packages that are not rid-specific.

Directory.Build.props

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@
1515
<PackageLicenseUrl>https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt</PackageLicenseUrl>
1616
<!-- The SPDX name for the source license. See https://spdx.org/licenses/. -->
1717
<PackageLicenseType>Apache-2.0</PackageLicenseType>
18-
<!--
19-
Suppress a warning about upcoming deprecation of PackageLicenseUrl. When embedding licenses are supported,
20-
replace PackageLicenseUrl with PackageLicenseExpression.
21-
-->
22-
<NoWarn>$(NoWarn);NU5125</NoWarn>
23-
<!-- Suppress warnings about using SemVer 2.0. -->
24-
<NoWarn>$(NoWarn);NU5105</NoWarn>
25-
<!-- Don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
26-
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>
2718

2819
<!-- Contact email address for NuGet packages and Linux installers. -->
2920
<MaintainerEmail>[email protected]</MaintainerEmail>
@@ -42,20 +33,46 @@
4233
<SharedFxDescription>Shared Framework for hosting of Microsoft ASP.NET Core applications. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub ($(RepositoryUrl)). We happily accept issues and PRs.</SharedFxDescription>
4334
</PropertyGroup>
4435

36+
<!-- Warnings and errors -->
37+
<PropertyGroup>
38+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
39+
<!--
40+
Suppress NuGet warning about upcoming deprecation of PackageLicenseUrl. When embedding licenses are supported,
41+
replace PackageLicenseUrl with PackageLicenseExpression.
42+
-->
43+
<NoWarn>$(NoWarn);NU5125</NoWarn>
44+
<!-- Suppress NuGet warnings about using SemVer 2.0. -->
45+
<NoWarn>$(NoWarn);NU5105</NoWarn>
46+
<!-- Don't make missing XML docs a fatal build error, but still surface so we have visibility into undocumented APIs. -->
47+
<WarningsNotAsErrors>$(WarningsNotAsErrors);CS1591</WarningsNotAsErrors>
48+
<!-- xUnit1004 = warns about skipped tests. Make this a non-fatal build warning. -->
49+
<WarningsNotAsErrors>$(WarningsNotAsErrors);xUnit1004</WarningsNotAsErrors>
50+
</PropertyGroup>
51+
4552
<!-- Source code settings -->
4653
<PropertyGroup>
4754
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
4855
<RepositoryUrl>https://github.com/aspnet/AspNetCore</RepositoryUrl>
4956
<RepositoryType>git</RepositoryType>
5057
<SharedSourceRoot>$(MSBuildThisFileDirectory)src\Shared\</SharedSourceRoot>
5158
<GoogleTestSubmoduleRoot>$(RepositoryRoot)src\submodules\googletest\</GoogleTestSubmoduleRoot>
59+
<!-- Embed source files that are not tracked by the source control manager in the PDB. -->
60+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
61+
<!-- Additional assembly attributes are already configured to include the source revision ID. -->
62+
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
63+
64+
<!-- These project types are disabled because the presence of a PackageReference causes issues for NuGet. -->
65+
<DisableSourceLink Condition="'$(MSBuildProjectExtension)' == '.zipproj' OR '$(MSBuildProjectExtension)' == '.debproj' OR '$(MSBuildProjectExtension)' == '.rpmproj'">true</DisableSourceLink>
5266
</PropertyGroup>
5367

68+
<ItemGroup Condition="'$(DisableSourceLink)' != 'true'">
69+
<!-- See https://github.com/dotnet/sourcelink -->
70+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubPackageVersion)" PrivateAssets="All" AllowExplicitReference="true" />
71+
<PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="$(MicrosoftSourceLinkVstsGitPackageVersion)" PrivateAssets="All" AllowExplicitReference="true" />
72+
</ItemGroup>
73+
5474
<!-- Compilation options which apply to all languages. Language-specific options should be set in eng/targets/$(lang).Common.props -->
5575
<PropertyGroup>
56-
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)eng\AspNetCore.snk</AssemblyOriginatorKeyFile>
57-
<SignAssembly>true</SignAssembly>
58-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5976
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6077
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6178
<PlatformName Condition=" '$(PlatformName)' == '' ">$(Platform)</PlatformName>
@@ -77,16 +94,14 @@
7794
linux-arm64
7895
</SupportedRuntimeIdentifiers>
7996

80-
<!-- Instructs the compiler to use SHA256 instead of SHA1 when adding file hashes to PDBs. -->
81-
<ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
97+
<!-- Make error messages clickable in VS Code's console -->
98+
<GenerateFullPaths Condition="'$(VSCODE_PID)' != ''">true</GenerateFullPaths>
99+
82100
<!-- Suppress the message about using a preview version of .NET Core SDK. We are okay with this and don't need the warning. -->
83101
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
84102

85103
<!-- Fixes a common error in targets implementing a NoBuild mode. -->
86104
<BuildProjectReferences Condition=" '$(NoBuild)' == 'true' ">false</BuildProjectReferences>
87-
88-
<!-- Enables Strict mode for Roslyn compiler -->
89-
<Features>strict</Features>
90105
</PropertyGroup>
91106

92107
<Import Project="eng\Versions.props" />
@@ -139,12 +154,17 @@
139154
<IsTestAssetProject Condition="$(RepoRelativeProjectDir.Contains('testassets'))">true</IsTestAssetProject>
140155
<IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>
141156
<IsAnalyzersProject Condition="$(MSBuildProjectName.EndsWith('.Analyzers'))">true</IsAnalyzersProject>
142-
<DisableDeterministicSourceRoot Condition="'$(IsSampleProject)' == 'true' OR '$(IsTestAssetProject)' == 'true'">true</DisableDeterministicSourceRoot>
143157
</PropertyGroup>
144158

145159
<Import Project="build\tasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />
146160

147161
<PropertyGroup>
162+
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
163+
<!--
164+
Disable deterministic source paths in test assets and samples.
165+
In order for the debugger to find source files when debugging a locally built binary the PDB must contain original, unmapped local paths
166+
-->
167+
<DeterministicSourcePaths Condition="'$(IsSampleProject)' == 'true' OR '$(IsTestAssetProject)' == 'true'">false</DeterministicSourcePaths>
148168
<!-- Projects which reference Microsoft.AspNetCore.Mvc.Testing should import this targets file to ensure dependency .deps.json files are copied into test output. -->
149169
<MvcTestingTargets>$(MSBuildThisFileDirectory)src\Mvc\src\Microsoft.AspNetCore.Mvc.Testing\Microsoft.AspNetCore.Mvc.Testing.targets</MvcTestingTargets>
150170
<!-- IIS native projects can only be built on Windows for x86 and x64. -->

Directory.Build.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<BuildHelixPayload Condition="'$(BuildHelixPayload)' == '' AND '$(IsTestProject)' == 'true'">true</BuildHelixPayload>
6868
</PropertyGroup>
6969

70+
<Import Project="eng\Workarounds.targets" />
7071
<Import Project="eng\targets\ResolveIisReferences.targets" Condition=" '$(MSBuildProjectExtension)' != '.vcxproj' " />
7172
<Import Project="eng\targets\Cpp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'" />
7273
<Import Project="eng\targets\CSharp.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />

build/Maestro/Maestro.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
</Target>
2424

2525
<Target Name="GenerateBuildAssetManifest"
26-
DependsOnTargets="GetFilesToPublish;ResolveRepositoryBranch;ResolveCommitHash">
26+
DependsOnTargets="GetFilesToPublish">
2727

2828
<GenerateBuildManifest
2929
Artifacts="@(PackageToPublish)"
3030
OutputPath="$(ManifestsPath)aspnetcore-$(TargetRuntimeIdentifier)-$(PackageVersion).xml"
3131
BuildId="$(PackageVersion)"
32-
RepoUri="$(RepositoryUrl)"
33-
RepoBranch="$(RepositoryBranch)"
34-
RepoCommit="$(RepositoryCommit)" />
32+
RepoUri="$(BUILD_REPOSITORY_URI)"
33+
RepoBranch="$(BUILD_SOURCEBRANCH)"
34+
RepoCommit="$(BUILD_SOURCEVERSION)" />
3535
</Target>
3636

3737
</Project>

build/SharedFx.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<Target Name="BuildSharedFx" DependsOnTargets="$(BuildSharedFxDependsOn)" />
2323

24-
<Target Name="_BuildSharedFxProjects" DependsOnTargets="ResolveCommitHash">
24+
<Target Name="_BuildSharedFxProjects">
2525

2626
<PropertyGroup>
2727
<_RestoreGraphProjectInput>@(FxProjectToBuild)</_RestoreGraphProjectInput>

build/repo.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<Import Project="AzureIntegration.targets" />
33
<Import Project="SharedFx.targets" />
44
<Import Project="CodeSign.targets" />
5-
<Import Project="..\eng\Workarounds.targets" />
65

76
<PropertyGroup>
87
<!-- Some projects need access to tasks bundled in KoreBuild. -->

dockerbuild.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fi
9898
commit_hash="$(git rev-parse HEAD || true)"
9999

100100
if [ ! -z "$commit_hash" ]; then
101-
build_args[${#build_args[*]}]="-p:RepositoryCommit=$commit_hash"
101+
build_args[${#build_args[*]}]="-p:SourceRevisionId=$commit_hash"
102102
fi
103103

104104
dockerfile="$DIR/build/docker/$image.Dockerfile"
@@ -118,6 +118,9 @@ docker run \
118118
-e TEAMCITY_VERSION \
119119
-e BUILD_NUMBER \
120120
-e BUILD_BUILDNUMBER \
121+
-e BUILD_REPOSITORY_URI \
122+
-e BUILD_SOURCEVERSION \
123+
-e BUILD_SOURCEBRANCH \
121124
-e DOTNET_CLI_TELEMETRY_OPTOUT \
122125
-e Configuration \
123126
-v "$DIR:/code/build" \

eng/Versions.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
<InternalAspNetCoreSdkPackageVersion Condition=" '$(KoreBuildVersion)' == '' ">3.0.0-build-20190130.1</InternalAspNetCoreSdkPackageVersion>
131131
<MicrosoftNETFrameworkReferenceAssembliesPackageVersion>1.0.0-alpha-004</MicrosoftNETFrameworkReferenceAssembliesPackageVersion>
132132
<MicrosoftNETTestSdkPackageVersion>15.9.0</MicrosoftNETTestSdkPackageVersion>
133+
<MicrosoftSourceLinkGitHubPackageVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkGitHubPackageVersion>
134+
<MicrosoftSourceLinkVstsGitPackageVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVstsGitPackageVersion>
133135
<!-- Stable dotnet/corefx packages no longer updated for .NET Core 3 -->
134136
<SystemBuffersPackageVersion>4.5.0</SystemBuffersPackageVersion>
135137
<SystemCodeDomPackageVersion>4.4.0</SystemCodeDomPackageVersion>

eng/Workarounds.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
<!-- Use this file to workaround issues. List the issue tracking the item to fix so we can remove the workaround when the issue is resolved. -->
22
<Project>
3+
4+
<!-- Workaround https://github.com/aspnet/AspNetCore/issues/7503. This chains GenerateSourceLinkFile before razor component targets run. -->
5+
<Target Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration"
6+
BeforeTargets="PrepareForRazorComponentGenerate"
7+
DependsOnTargets="GenerateSourceLinkFile" />
8+
39
</Project>

eng/targets/CSharp.Common.props

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
<PropertyGroup>
44
<LangVersion>7.3</LangVersion>
5+
6+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\AspNetCore.snk</AssemblyOriginatorKeyFile>
7+
<SignAssembly>true</SignAssembly>
8+
9+
<!-- Instructs the compiler to use SHA256 instead of SHA1 when adding file hashes to PDBs. -->
10+
<ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
11+
12+
<!-- Enables Strict mode for Roslyn compiler -->
13+
<Features>strict</Features>
14+
15+
<!-- Disables targets in Internal.AspNetCore.Sdk which are obsolete. -->
16+
<GenerateSourceLinkFile>false</GenerateSourceLinkFile>
17+
<GenerateRepositoryCommitUrlInDescription>false</GenerateRepositoryCommitUrlInDescription>
18+
<GenerateCommitHashAttribute>false</GenerateCommitHashAttribute>
19+
<GenerateInternalAspNetCoreAttributes>false</GenerateInternalAspNetCoreAttributes>
20+
<DisableDeterministicSourceRoot>true</DisableDeterministicSourceRoot>
521
</PropertyGroup>
622

723
<ItemGroup>

eng/targets/CSharp.Common.targets

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,35 @@
55
<TargetFramework>net$(TargetFrameworkVersion.Substring(1).Replace('.',''))</TargetFramework>
66
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
77
</PropertyGroup>
8-
8+
9+
<Target Name="GetCustomAssemblyAttributes"
10+
BeforeTargets="GetAssemblyAttributes"
11+
DependsOnTargets="InitializeSourceControlInformation">
12+
13+
<ItemGroup>
14+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(SourceRevisionId)' != ''">
15+
<_Parameter1>CommitHash</_Parameter1>
16+
<_Parameter2>$(SourceRevisionId)</_Parameter2>
17+
</AssemblyAttribute>
18+
19+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="$(RepositoryUrl.StartsWith('https://github.com'))">
20+
<_Parameter1>SourceCommitUrl</_Parameter1>
21+
<_Parameter2>$(RepositoryUrl)/tree/$(SourceRevisionId)</_Parameter2>
22+
</AssemblyAttribute>
23+
24+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(Serviceable)' == 'true'">
25+
<_Parameter1>Serviceable</_Parameter1>
26+
<_Parameter2>True</_Parameter2>
27+
</AssemblyAttribute>
28+
</ItemGroup>
29+
</Target>
30+
31+
<Target Name="GetCustomFileVersion" BeforeTargets="GetAssemblyVersion">
32+
<PropertyGroup Condition="'$(FileVerison)' == '' AND '$(FileRevisionVersion)' != ''">
33+
<FileVersion>$(VersionPrefix).$(FileRevisionVersion)</FileVersion>
34+
</PropertyGroup>
35+
</Target>
36+
937
<Import Project="Packaging.targets" />
1038
<Import Project="ResolveReferences.targets" />
1139
</Project>

eng/targets/Packaging.targets

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,17 @@
1919
</ItemGroup>
2020
</Target>
2121

22+
<PropertyGroup>
23+
<GenerateNuspecDependsOn>$(GenerateNuspecDependsOn);_AppendRepostoryUrlToPackageDescription</GenerateNuspecDependsOn>
24+
</PropertyGroup>
25+
26+
<Target Name="_AppendRepostoryUrlToPackageDescription"
27+
DependsOnTargets="InitializeSourceControlInformation">
28+
<PropertyGroup Condition="'$(RepositoryUrl)' != '' AND '$(SourceRevisionId)' != ''">
29+
<PackageDescription>$(PackageDescription)
30+
31+
This package was built from the source code at $(RepositoryUrl)/tree/$(SourceRevisionId)</PackageDescription>
32+
</PropertyGroup>
33+
</Target>
34+
2235
</Project>

eng/targets/Wix.Common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</PropertyGroup>
99

1010
<PropertyGroup>
11-
<!-- Required to make NuGet happy -->
12-
<TargetFramework>net461</TargetFramework>
11+
<TargetFrameworkMoniker>Native,Version=v0.0</TargetFrameworkMoniker>
12+
1313
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)</MSBuildProjectExtensionsPath>
1414
<MSBuildProjectExtensionsPath Condition="'$(MSBuildProjectExtensionsPath)' == ''">$(MSBuildProjectDir)\obj\</MSBuildProjectExtensionsPath>
1515
<!-- IsRunningFromVisualStudio may be true even when running msbuild.exe from command line. This generally means that MSBUild is Visual Studio installation and therefore we need to find NuGet.targets in a different location. -->

src/Azure/AzureAD/Authentication.AzureAD.UI/src/Microsoft.AspNetCore.Authentication.AzureAD.UI.csproj

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,4 @@
2222
<Reference Include="Microsoft.NET.Sdk.Razor" PrivateAssets="All" />
2323
</ItemGroup>
2424

25-
<ItemGroup>
26-
<RazorAssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(BuildNumber)' != ''">
27-
<_Parameter1>BuildNumber</_Parameter1>
28-
<_Parameter2>$(BuildNumber)</_Parameter2>
29-
</RazorAssemblyAttribute>
30-
31-
<RazorTargetAssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(BuildNumber)' != ''">
32-
<_Parameter1>BuildNumber</_Parameter1>
33-
<_Parameter2>$(BuildNumber)</_Parameter2>
34-
</RazorTargetAssemblyAttribute>
35-
</ItemGroup>
36-
37-
<ItemGroup>
38-
<RazorCompile Include="$(GeneratedCommitHashAttributeFile)" />
39-
<RazorCompile Include="$(GeneratedInternalAspNetCoreAttributeFile)" />
40-
</ItemGroup>
41-
4225
</Project>

src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Microsoft.AspNetCore.Authentication.AzureADB2C.UI.csproj

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,4 @@
2222
<Reference Include="Microsoft.NET.Sdk.Razor" PrivateAssets="All" />
2323
</ItemGroup>
2424

25-
<ItemGroup>
26-
<RazorAssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(BuildNumber)' != ''">
27-
<_Parameter1>BuildNumber</_Parameter1>
28-
<_Parameter2>$(BuildNumber)</_Parameter2>
29-
</RazorAssemblyAttribute>
30-
31-
<RazorTargetAssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(BuildNumber)' != ''">
32-
<_Parameter1>BuildNumber</_Parameter1>
33-
<_Parameter2>$(BuildNumber)</_Parameter2>
34-
</RazorTargetAssemblyAttribute>
35-
</ItemGroup>
36-
37-
<ItemGroup>
38-
<RazorCompile Include="$(GeneratedCommitHashAttributeFile)" />
39-
<RazorCompile Include="$(GeneratedInternalAspNetCoreAttributeFile)" />
40-
</ItemGroup>
41-
4225
</Project>

src/Components/Blazor/Build/src/Microsoft.AspNetCore.Blazor.Build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
componentsversion=$(ComponentsPackageVersion);
2929
razorversion=$(MicrosoftAspNetCoreRazorDesignPackageVersion);
3030
blazormonoversion=$(MicrosoftAspNetCoreBlazorMonoPackageVersion);
31-
repositorycommit=$(RepositoryCommit);</NuspecProperties>
31+
repositorycommit=$(SourceRevisionId);</NuspecProperties>
3232
</PropertyGroup>
3333
<ItemGroup>
3434
<_TargetFramework Include="$(TargetFramework)" />

src/Components/Blazor/Cli/src/Microsoft.AspNetCore.Blazor.Cli.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
blazorversion=$(PackageVersion);
3636
aspnetcoreversion=$(ComponentsPackageVersion);
3737
sharedfxversion=$(SharedFxVersion);
38-
repositorycommit=$(RepositoryCommit);</NuspecProperties>
38+
repositorycommit=$(SourceRevisionId);</NuspecProperties>
3939
</PropertyGroup>
4040
<!-- Also temporarily generate the runtimeconfig.json manually until we can use <FrameworkReference> -->
4141
<Sdk_GenerateFileFromTemplate

src/Components/Blazor/Templates/src/SetPackageProperties.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
IncludeCustomRestoreSources=$(IncludeCustomRestoreSourcesValue);
2323
TemplateBlazorVersion=$(PackageVersion);
2424
TemplateComponentsVersion=$(ComponentsPackageVersion);
25-
RepositoryCommit=$(RepositoryCommit);
25+
RepositoryCommit=$(SourceRevisionId);
2626
</GeneratedContentProperties>
2727
</PropertyGroup>
2828
</Target>

src/Components/Build/src/Microsoft.AspNetCore.Components.Build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PropertyGroup>
1818
<NuspecProperties>
1919
version=$(PackageVersion);
20-
repositorycommit=$(RepositoryCommit);
20+
repositorycommit=$(SourceRevisionId);
2121
</NuspecProperties>
2222
</PropertyGroup>
2323
</Target>

src/Framework/src/SharedFx.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ This targets file should only be imported by .shfxproj files.
174174
</Target>
175175

176176
<!-- Generates the .version file in the shared framework -->
177-
<Target Name="GenerateSharedFxVersionsFile">
177+
<Target Name="GenerateSharedFxVersionsFile" DependsOnTargets="InitializeSourceControlInformation">
178178
<ItemGroup>
179-
<VersionLines Include="$(RepositoryCommit)" />
179+
<VersionLines Include="$(SourceRevisionId)" />
180180
<VersionLines Include="$(PackageVersion)" />
181181
</ItemGroup>
182182

@@ -369,7 +369,7 @@ This targets file should only be imported by .shfxproj files.
369369
projectUrl=$(PackageProjectUrl);
370370
iconUrl=$(PackageIconUrl);
371371
repositoryUrl=$(RepositoryUrl);
372-
repositoryCommit=$(RepositoryCommit);
372+
repositoryCommit=$(SourceRevisionId);
373373
copyright=$(Copyright);
374374
targetFramework=$(TargetFramework);
375375
symbolsAssets=$([MSBuild]::NormalizeDirectory($(SymbolsOutputPath)));

0 commit comments

Comments
 (0)