Skip to content

Set correct ProductVersion for productVersion.txt #54710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@
<!-- Remove wixpacks if not doing post-build signing, since they are not needed -->
<_InstallersToPublish Remove="$(ArtifactsDir)installers\**\*.wixpack.zip" Condition="'$(PostBuildSign)' != 'true'" />

<Artifact Include="@(_InstallersToPublish)"
PublishFlatContainer="true">
<Artifact Include="@(_InstallersToPublish)">
<!-- Working around msbuild not being able to negate the result of Contains() outside of targets -->
<IsShipping Condition="$([System.String]::Copy('%(Filename)').ToLowerInvariant().Contains('internal')) == 'True'">false</IsShipping>
<IsShipping Condition="$([System.String]::Copy('%(Filename)').ToLowerInvariant().Contains('internal')) != 'True'">true</IsShipping>
</Artifact>
</ItemGroup>

<Target Name="GetProductVersion">
<Target Name="GetNonStableProductVersion">
<!--
This target is defined in eng/targets/Packaging.targets and Npm.Common.targets and included in every C#, F#,
and npm project. We use Microsoft.AspNetCore.InternalTesting.csproj because it is non-shipping (we need a non-stable
Expand All @@ -65,14 +64,24 @@
</MSBuild>

<PropertyGroup>
<ProductVersion>%(_ResolvedPackageVersionInfo.PackageVersion)</ProductVersion>
<NonStableProductVersion>%(_ResolvedPackageVersionInfo.PackageVersion)</NonStableProductVersion>
</PropertyGroup>
</Target>

<Target Name="GenerateProductVersionFiles"
BeforeTargets="PublishToAzureDevOpsArtifacts"
DependsOnTargets="GetProductVersion"
DependsOnTargets="GetNonStableProductVersion"
Condition="'$(PublishInstallerBaseVersion)' == 'true'">
<MSBuild Projects="$(RepoRoot)src\Testing\src\Microsoft.AspNetCore.InternalTesting.csproj"
Properties="ExcludeFromBuild=false;IsShipping=true"
Targets="_GetPackageVersionInfo">
<Output TaskParameter="TargetOutputs" ItemName="_ResolvedPackageVersionInfo" />
</MSBuild>

<PropertyGroup>
<ProductVersion>%(_ResolvedPackageVersionInfo.PackageVersion)</ProductVersion>
</PropertyGroup>

<ItemGroup>
<ProductVersionFile Include="$(ArtifactsShippingPackagesDir)productVersion.txt" />
<ProductVersionFile Include="$(ArtifactsShippingPackagesDir)aspnetcore-productVersion.txt" />
Expand All @@ -86,18 +95,17 @@

<ItemGroup>
<Artifact Include="@(ProductVersionFile)"
PublishFlatContainer="true"
RelativeBlobPath="aspnetcore/Runtime/$(ProductVersion)/%(Filename)%(Extension)" />
RelativeBlobPath="aspnetcore/Runtime/$(NonStableProductVersion)/%(Filename)%(Extension)" />
</ItemGroup>
</Target>

<Target Name="AddRelativeBlobPathToInstallerArtifacts"
BeforeTargets="PublishToAzureDevOpsArtifacts"
AfterTargets="GenerateChecksumsFromArtifacts"
DependsOnTargets="GetProductVersion">
DependsOnTargets="GetNonStableProductVersion">
<ItemGroup>
<Artifact Condition="'%(Artifact.PublishFlatContainer)' == 'true' and '%(Artifact.UploadPathSegment)' != ''"
RelativeBlobPath="aspnetcore/%(Artifact.UploadPathSegment)/$(ProductVersion)/%(Filename)%(Extension)" />
RelativeBlobPath="aspnetcore/%(Artifact.UploadPathSegment)/$(NonStableProductVersion)/%(Filename)%(Extension)" />
</ItemGroup>
</Target>

Expand Down