Skip to content

Commit dfe9470

Browse files
committedMar 11, 2021
Adding workload manifests to installers
1 parent ce39a16 commit dfe9470

10 files changed

+309
-1
lines changed
 

‎NuGet.config

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
1616
<add key="dotnet6-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json" />
1717
<add key="dotnet-libraries" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-libraries/nuget/v3/index.json" />
18+
<!-- Temporary feed for Xamarin workload manifest -->
19+
<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
1820
</packageSources>
1921
<disabledPackageSources />
2022
</configuration>

‎eng/Versions.props

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@
144144
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
145145
<MicrosoftNETTestSdkVersion>16.10.0-preview-20210304-04</MicrosoftNETTestSdkVersion>
146146
</PropertyGroup>
147+
<PropertyGroup>
148+
<XamarinAndroidWorkloadManifestVersion>11.2.0-ci.d16-9.0</XamarinAndroidWorkloadManifestVersion>
149+
<BlazorWorkloadManifestVersion>6.0.0-preview.3.21161.5</BlazorWorkloadManifestVersion>
150+
</PropertyGroup>
147151
<PropertyGroup>
148152
<!-- pinned dependency. This package is not being produced outside of the 2.0 branch of corefx and should not change. -->
149153
<CLI_NETStandardLibraryNETFrameworkVersion>2.0.1-servicing-26011-01</CLI_NETStandardLibraryNETFrameworkVersion>

‎src/redist/redist.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<Import Project="targets\Versions.targets" />
3232
<Import Project="targets\Branding.targets" />
3333
<Import Project="targets\BundledTemplates.targets" />
34+
<Import Project="targets\BundledManifests.targets" />
3435
<Import Project="targets\BundledDotnetTools.targets" />
3536
<Import Project="targets\GenerateBundledVersions.targets" />
3637
<Import Project="targets\Crossgen.targets" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
3+
<ItemGroup>
4+
<BundledManifests Include="Microsoft.NET.Workload.Android" Version="$(XamarinAndroidWorkloadManifestVersion)" WorkloadId="Microsoft.NET.Workload.Android" />
5+
<BundledManifests Include="Microsoft.NET.Sdk.BlazorWebAssembly.AOT" Version="$(BlazorWorkloadManifestVersion)" WorkloadId="Microsoft.NET.Workload.BlazorWebAssembly" />
6+
</ItemGroup>
7+
8+
<!-- Restore workload manifests via PackageReference -->
9+
<ItemGroup>
10+
<PackageReference Include="@(BundledManifests)" />
11+
</ItemGroup>
12+
13+
<Target Name="LayoutManifests"
14+
DependsOnTargets="LayoutManifestsForSDK;LayoutManifestsForMSI" />
15+
16+
<Target Name="LayoutManifestsForSDK"
17+
DependsOnTargets="SetupBundledComponents;GenerateManifestVersions">
18+
19+
<Copy SourceFiles="@(ManifestContent)"
20+
DestinationFolder="$(RedistLayoutPath)sdk-manifests/$(CliProductBandVersion)00/%(DestinationPath)"/>
21+
22+
</Target>
23+
24+
<Target Name="LayoutManifestsForMSI"
25+
DependsOnTargets="SetupBundledComponents;GenerateManifestVersions"
26+
Condition="$(ProductMonikerRid.StartsWith('win')) And '$(Architecture)' != 'arm'">
27+
28+
<Copy SourceFiles="@(ManifestContent)"
29+
DestinationFolder="$(BaseOutputPath)$(Configuration)\sdk-manifests\sdk-manifests/$(CliProductBandVersion)00/%(DestinationPath)"/>
30+
31+
</Target>
32+
33+
<Target Name="GenerateManifestVersions">
34+
35+
<PropertyGroup>
36+
<ManifestsMSIInstallerFile>$(ArtifactsNonShippingPackagesDir)dotnet-sdkmanifests-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension)</ManifestsMSIInstallerFile>
37+
<ManifestsDependencyKeyName>SDK_Manifests_$([System.String]::Copy('$(Version)').Replace('-', '_'))</ManifestsDependencyKeyName>
38+
<ManifestsBrandName>Microsoft .NET SDK Workload Manifests $(Version)</ManifestsBrandName>
39+
<ManifestsLayoutPath>$(BaseOutputPath)$(Configuration)\sdk-manifests</ManifestsLayoutPath>
40+
</PropertyGroup>
41+
42+
<GenerateMsiVersion BuildNumber="$(CombinedBuildNumberAndRevision)"
43+
Major="$(VersionMajor)"
44+
Minor="$(VersionMinor)"
45+
Patch="$(VersionFeature)">
46+
<Output TaskParameter="MsiVersion" PropertyName="ManifestMsiVersion" />
47+
</GenerateMsiVersion>
48+
49+
<GenerateGuidFromName Name="$(ManifestsMSIInstallerFile)">
50+
<Output TaskParameter="GeneratedGuid"
51+
PropertyName="ManifestsInstallerUpgradeCode" />
52+
</GenerateGuidFromName>
53+
54+
<ItemGroup>
55+
<BundledManifests Update="@(BundledManifests)" >
56+
<RestoredNupkgContentPath>$(NuGetPackageRoot)%(Identity)/%(Version)</RestoredNupkgContentPath>
57+
</BundledManifests>
58+
59+
<ManifestContent Include="%(BundledManifests.RestoredNupkgContentPath)\**\*.json;%(BundledManifests.RestoredNupkgContentPath)\**\*.targets"
60+
DestinationPath="%(WorkloadId)/"/>
61+
</ItemGroup>
62+
</Target>
63+
64+
</Project>

‎src/redist/targets/GenerateLayout.targets

+1
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@
501501
GenerateBundledVersions;
502502
LayoutRuntimeGraph;
503503
LayoutTemplates;
504+
LayoutManifests;
504505
LayoutBundledTools;
505506
RetargetTools;
506507
CrossgenLayout;

‎src/redist/targets/GenerateMSIs.targets

+44-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<ItemGroup>
9898
<GeneratedInstallers Include="$(SdkMSIInstallerFile);$(CombinedFrameworkSdkHostMSIInstallerFile);$(SdkPlaceholderMSIInstallerFile)" />
9999
<GeneratedInstallers Include="@(TemplatesMsiComponent->'%(MSIInstallerFile)')" />
100+
<GeneratedInstallers Include="@(BundledManifests->'%(MSIInstallerFile)')" />
100101
</ItemGroup>
101102

102103
<GenerateMsiVersion BuildNumber="$(CombinedBuildNumberAndRevision)"
@@ -270,8 +271,48 @@
270271
</ItemGroup>
271272
</Target>
272273

274+
<Target Name="GenerateManifestsMsi"
275+
DependsOnTargets="GenerateLayout;AcquireWix;MsiTargetsSetupInputOutputs;SetSdkBrandingInfo"
276+
Condition="$(ProductMonikerRid.StartsWith('win')) And '$(Architecture)' != 'arm'"
277+
Inputs="@(BundledManifests);$(ManifestsGenerateMsiPowershellScript)"
278+
Outputs="$(ManifestsMSIInstallerFile)">
279+
280+
<PropertyGroup>
281+
<ManifestsGenerateMsiPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatemanifestsmsi.ps1</ManifestsGenerateMsiPowershellScript>
282+
</PropertyGroup>
283+
284+
<Exec Command="powershell -NoProfile -NoLogo $(ManifestsGenerateMsiPowershellScript) ^
285+
'$(ManifestsLayoutPath)' ^
286+
'$(ManifestsMSIInstallerFile)' ^
287+
'$(WixRoot)' ^
288+
'$(ManifestsBrandName)' ^
289+
'$(ManifestMsiVersion)' ^
290+
'$(ManifestMsiVersion)' ^
291+
'$(FullNugetVersion)' ^
292+
'$(ManifestsInstallerUpgradeCode)' ^
293+
'$(ManifestsDependencyKeyName)' ^
294+
'$(Architecture)' ^
295+
-InformationAction Continue" />
296+
<ItemGroup>
297+
<ManifestsMsiWixSrcFiles Include="$(WixRoot)\provider.wixobj" />
298+
<ManifestsMsiWixSrcFiles Include="$(WixRoot)\Manifests.wixobj" />
299+
<ManifestsMsiWixSrcFiles Include="$(WixRoot)\Manifest-install-files.wixobj" />
300+
</ItemGroup>
301+
302+
<CreateLightCommandPackageDrop
303+
LightCommandWorkingDir="$(LightCommandObjDir)"
304+
OutputFolder="$(LightCommandPackagesDir)"
305+
NoLogo="true"
306+
Cultures="en-us"
307+
InstallerFile="$(ArtifactsNonShippingPackagesDir)$(ManifestsMSIInstallerFile)"
308+
WixExtensions="WixUIExtension;WixDependencyExtension;WixUtilExtension"
309+
WixSrcFiles="@(ManifestsMsiWixSrcFiles)">
310+
<Output TaskParameter="OutputFile" PropertyName="_LightCommandPackageNameOutput" />
311+
</CreateLightCommandPackageDrop>
312+
</Target>
313+
273314
<Target Name="GenerateSdkBundle"
274-
DependsOnTargets="GenerateLayout;AcquireWix;MsiTargetsSetupInputOutputs;GenerateSdkMsi;SignSdkMsi;GenerateTemplatesMsis;SignTemplatesMsis"
315+
DependsOnTargets="GenerateLayout;AcquireWix;MsiTargetsSetupInputOutputs;GenerateSdkMsi;SignSdkMsi;GenerateTemplatesMsis;GenerateManifestsMsi;SignTemplatesMsis"
275316
Condition=" '$(OS)' == 'Windows_NT' "
276317
Inputs="$(SdkMSIInstallerFile);
277318
$(DownloadedSharedFrameworkInstallerFile);
@@ -305,6 +346,7 @@
305346
'$(DownloadsFolder)$(DownloadedAspNetTargetingPackInstallerFileName)' ^
306347
'$(DownloadsFolder)$(DownloadedWindowsDesktopTargetingPackInstallerFileName)' ^
307348
'$(LatestTemplateMsiInstallerFile)' ^
349+
'$(ManifestsMsiInstallerFile)' ^
308350
'$(CombinedFrameworkSdkHostMSIInstallerFile)' ^
309351
'$(WixRoot)' ^
310352
'$(SdkBrandName)' ^
@@ -481,6 +523,7 @@
481523
GenerateSdkMsi;
482524
SignSdkMsi;
483525
GenerateTemplatesMsis;
526+
GenerateManifestsMsi;
484527
SignTemplatesMsis;
485528
GenerateSdkBundle;
486529
SignSdkBundle;

‎src/redist/targets/packaging/windows/clisdk/bundle.wxs

+4
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
176176
<MsiProperty Name="ALLOWMSIINSTALL" Value="True" />
177177
</MsiPackage>
178+
<MsiPackage SourceFile="$(var.ManifestsMsiSourcePath)">
179+
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
180+
<MsiProperty Name="ALLOWMSIINSTALL" Value="True" />
181+
</MsiPackage>
178182
<MsiPackage SourceFile="$(var.CLISDKMsiSourcePath)">
179183
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
180184
<MsiProperty Name="DOTNETHOME_X86" Value="[DOTNETHOME_X86]" />

‎src/redist/targets/packaging/windows/clisdk/generatebundle.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ param(
1717
[Parameter(Mandatory=$true)][string]$AspNetTargetingPackMSIFile,
1818
[Parameter(Mandatory=$true)][string]$WindowsDesktopTargetingPackMSIFile,
1919
[Parameter(Mandatory=$true)][string]$TemplatesMSIFile,
20+
[Parameter(Mandatory=$true)][string]$ManifestsMSIFile,
2021
[Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
2122
[Parameter(Mandatory=$true)][string]$WixRoot,
2223
[Parameter(Mandatory=$true)][string]$ProductMoniker,
@@ -63,6 +64,7 @@ function RunCandleForBundle
6364
-dAspNetTargetingPackMsiSourcePath="$AspNetTargetingPackMSIFile" `
6465
-dWindowsDesktopTargetingPackMsiSourcePath="$WindowsDesktopTargetingPackMSIFile" `
6566
-dTemplatesMsiSourcePath="$TemplatesMSIFile" `
67+
-dManifestsMsiSourcePath="$ManifestsMSIFile" `
6668
-dWinFormsAndWpfVersion="$WindowsDesktopVersion" `
6769
-dAdditionalSharedFXMsiSourcePath="$AdditionalSharedFxMSIFile" `
6870
-dAdditionalHostFXRMsiSourcePath="$AdditionalHostFxrMSIFile" `
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
param(
5+
[Parameter(Mandatory=$true)][string]$inputDir,
6+
[Parameter(Mandatory=$true)][string]$DotnetMSIOutput,
7+
[Parameter(Mandatory=$true)][string]$WixRoot,
8+
[Parameter(Mandatory=$true)][string]$ProductMoniker,
9+
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
10+
[Parameter(Mandatory=$true)][string]$SDKBundleVersion,
11+
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
12+
[Parameter(Mandatory=$true)][string]$UpgradeCode,
13+
[Parameter(Mandatory=$true)][string]$DependencyKeyName,
14+
[Parameter(Mandatory=$true)][string]$Architecture
15+
)
16+
17+
$InstallFileswsx = ".\manifest-install-files.wxs"
18+
$InstallFilesWixobj = "manifest-install-files.wixobj"
19+
20+
function RunHeat
21+
{
22+
$result = $true
23+
pushd "$WixRoot"
24+
25+
Write-Information "Running heat.."
26+
27+
$heatOutput = .\heat.exe dir `"$inputDir`" -template fragment `
28+
-sreg -ag `
29+
-var var.DotnetSrc `
30+
-cg InstallFiles `
31+
-srd `
32+
-dr DOTNETHOME `
33+
-out manifest-install-files.wxs
34+
35+
Write-Information "Heat output: $heatOutput"
36+
37+
if($LastExitCode -ne 0)
38+
{
39+
$result = $false
40+
Write-Information "Heat failed with exit code $LastExitCode."
41+
}
42+
43+
popd
44+
Write-Information "RunHeat result: $result"
45+
return $result
46+
}
47+
48+
function RunCandle
49+
{
50+
$result = $true
51+
pushd "$WixRoot"
52+
53+
Write-Information "Running candle.."
54+
55+
$candleOutput = .\candle.exe -nologo `
56+
-dDotnetSrc="$inputDir" `
57+
-dMicrosoftEula="$PSScriptRoot\dummyeula.rtf" `
58+
-dProductMoniker="$ProductMoniker" `
59+
-dBuildVersion="$DotnetMSIVersion" `
60+
-dSDKBundleVersion="$SDKBundleVersion" `
61+
-dNugetVersion="$DotnetCLINugetVersion" `
62+
-dUpgradeCode="$UpgradeCode" `
63+
-dDependencyKeyName="$DependencyKeyName" `
64+
-arch "$Architecture" `
65+
-ext WixDependencyExtension.dll `
66+
"$PSScriptRoot\manifests.wxs" `
67+
"$PSScriptRoot\provider.wxs" `
68+
$InstallFileswsx
69+
70+
Write-Information "Candle output: $candleOutput"
71+
72+
if($LastExitCode -ne 0)
73+
{
74+
$result = $false
75+
Write-Information "Candle failed with exit code $LastExitCode."
76+
}
77+
78+
popd
79+
return $result
80+
}
81+
82+
function RunLight
83+
{
84+
$result = $true
85+
pushd "$WixRoot"
86+
87+
Write-Information "Running light.."
88+
$CabCache = Join-Path $WixRoot "cabcache"
89+
90+
$lightOutput = .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
91+
-cultures:en-us `
92+
manifests.wixobj `
93+
provider.wixobj `
94+
$InstallFilesWixobj `
95+
-b "$inputDir" `
96+
-b "$PSScriptRoot" `
97+
-reusecab `
98+
-cc "$CabCache" `
99+
-out $DotnetMSIOutput
100+
101+
Write-Information "Light output: $lightOutput"
102+
103+
if($LastExitCode -ne 0)
104+
{
105+
$result = $false
106+
Write-Information "Light failed with exit code $LastExitCode."
107+
}
108+
109+
popd
110+
return $result
111+
}
112+
113+
if(!(Test-Path $inputDir))
114+
{
115+
throw "$inputDir not found"
116+
}
117+
118+
Write-Information "Creating manifests MSI at $DotnetMSIOutput"
119+
120+
if([string]::IsNullOrEmpty($WixRoot))
121+
{
122+
Exit -1
123+
}
124+
125+
if(-Not (RunHeat))
126+
{
127+
Write-Information "Heat failed"
128+
Exit -1
129+
}
130+
131+
if(-Not (RunCandle))
132+
{
133+
Write-Information "Candle failed"
134+
Exit -1
135+
}
136+
137+
if(-Not (RunLight))
138+
{
139+
Write-Information "Light failed"
140+
Exit -1
141+
}
142+
143+
if(!(Test-Path $DotnetMSIOutput))
144+
{
145+
throw "Unable to create the manifests MSI."
146+
Exit -1
147+
}
148+
149+
Write-Information "Successfully created manifests MSI - $DotnetMSIOutput"
150+
151+
exit $LastExitCode
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3+
<?include "Variables.wxi" ?>
4+
<Product Id="*" Name="$(var.ProductName)" Language="$(var.ProductLanguage)" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
5+
<Package Compressed="yes" InstallScope="perMachine" InstallerVersion="$(var.InstallerVersion)" />
6+
7+
<Condition Message="$(var.ProductName) must be installed as part of a coordinated SDK installation.">
8+
Installed OR ALLOWMSIINSTALL
9+
</Condition>
10+
11+
<MajorUpgrade DowngradeErrorMessage="$(var.DowngradeErrorMessage)" Schedule="afterInstallInitialize"/>
12+
13+
<MediaTemplate CompressionLevel="high" EmbedCab="yes" />
14+
<Feature Id="MainFeature" Title="Main Feature" Level="1">
15+
<ComponentGroupRef Id="InstallFiles" />
16+
</Feature>
17+
<Feature Id="Provider" Absent="disallow" AllowAdvertise="no" Description="Used for Ref Counting" Display="hidden" Level="1" InstallDefault="local" Title="RefCounting" TypicalDefault="install">
18+
<ComponentRef Id="$(var.DependencyKeyId)" />
19+
</Feature>
20+
<Property Id="ProductFamily" Value="$(var.ProductFamily)" />
21+
<Property Id="ProductEdition" Value="$(var.ProductEdition)" />
22+
<Property Id="ProductCPU" Value="$(var.Platform)" />
23+
<Property Id="RTM_ProductVersion" Value="$(var.Dotnet_ProductVersion)" />
24+
<Property Id="MSIFASTINSTALL" Value="7" />
25+
<Property Id="NUGETVERSION" Value="$(var.NugetVersion)" />
26+
<WixVariable Id="WixUILicenseRtf" Value="$(var.MicrosoftEula)" />
27+
28+
</Product>
29+
<Fragment>
30+
<Directory Id="TARGETDIR" Name="SourceDir">
31+
<Directory Id="$(var.Program_Files)">
32+
<Directory Id="DOTNETHOME" Name="dotnet"/>
33+
</Directory>
34+
</Directory>
35+
</Fragment>
36+
</Wix>

0 commit comments

Comments
 (0)
Please sign in to comment.