Introducing a SDK ARP Placeholder for Visual Studio

This commit is contained in:
jbeisner 2019-08-16 18:56:20 +00:00
parent 3cfc15c666
commit e367a32ce4
10 changed files with 253 additions and 2 deletions

View file

@ -15,12 +15,15 @@
<CombinedFrameworkSdkHostBundleEngineName>$(ArtifactsTmpDir)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)-engine.exe</CombinedFrameworkSdkHostBundleEngineName>
<SdkGenerateMsiPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatemsi.ps1</SdkGenerateMsiPowershellScript>
<SdkPlaceholderGenerateMsiPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatesdkplaceholdermsi.ps1</SdkPlaceholderGenerateMsiPowershellScript>
<SdkStableFileIdForApphostTransform>$(MSBuildThisFileDirectory)packaging/windows/clisdk/stablefileidforapphosttransform.xslt</SdkStableFileIdForApphostTransform>
<SdkGenerateBundlePowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatebundle.ps1</SdkGenerateBundlePowershellScript>
<GenerateNupkgPowershellScript>$(MSBuildThisFileDirectory)packaging/windows/clisdk/generatenupkg.ps1</GenerateNupkgPowershellScript>
<ToolsetInstallerNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.Toolset.nuspec</ToolsetInstallerNuspecFile>
<ToolsetInstallerNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.Toolset.$(Architecture).$(FullNugetVersion).nupkg</ToolsetInstallerNupkgFile>
<SdkPlaceholderInstallerNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Redist.Common.NetCore.SdkPlaceholder.nuspec</SdkPlaceholderInstallerNuspecFile>
<SdkPlaceholderInstallerNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Redist.Common.NetCore.SdkPlaceholder.$(Architecture).$(FullNugetVersion).nupkg</SdkPlaceholderInstallerNupkgFile>
<VSToolsNuspecFile>$(MSBuildThisFileDirectory)packaging/windows/clisdk/VS.Tools.Net.Core.SDK.nuspec</VSToolsNuspecFile>
<VSToolsNupkgFile>$(ArtifactsNonShippingPackagesDir)VS.Tools.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</VSToolsNupkgFile>
@ -36,9 +39,12 @@
<PropertyGroup>
<SdkMSIInstallerFile>$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkMSIInstallerFile>
<SdkMSICabFile>$(ArtifactsShippingPackagesDir)d$(Architecture)-1.cab</SdkMSICabFile>
<SdkDependencyKeyPrefix>Dotnet_CLI</SdkDependencyKeyPrefix>
<Templates30MSIInstallerFile>$(ArtifactsShippingPackagesDir)dotnet-30templates-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension)</Templates30MSIInstallerFile>
<Templates22MSIInstallerFile>$(ArtifactsShippingPackagesDir)dotnet-22templates-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension)</Templates22MSIInstallerFile>
<Templates21MSIInstallerFile>$(ArtifactsShippingPackagesDir)dotnet-21templates-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension)</Templates21MSIInstallerFile>
<SdkPlaceholderMSIInstallerFile>$(ArtifactsShippingPackagesDir)dotnet-sdkplaceholder-$(FullNugetVersion)-$(ProductMonikerRid)$(InstallerExtension)</SdkPlaceholderMSIInstallerFile>
<SdkPlaceholderDependencyKeyPrefix>NetCore_SdkPlaceholder</SdkPlaceholderDependencyKeyPrefix>
<CombinedFrameworkSdkHostMSIInstallerFile>$(ArtifactsShippingPackagesDir)$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension)</CombinedFrameworkSdkHostMSIInstallerFile>
<SdkBundleInstallerOutputGuidString>$(ProductBandCombinedHostHostFxrFrameworkSdkName)</SdkBundleInstallerOutputGuidString>
@ -54,7 +60,7 @@
DependsOnTargets="GenerateLayout;SetupWixProperties;GetCoreSdkGitCommitInfo">
<!-- Consumed By Publish -->
<ItemGroup>
<GeneratedInstallers Include="$(SdkMSIInstallerFile);$(Templates30MSIInstallerFile);$(Templates22MSIInstallerFile);$(Templates21MSIInstallerFile);$(CombinedFrameworkSdkHostMSIInstallerFile)" />
<GeneratedInstallers Include="$(SdkMSIInstallerFile);$(Templates30MSIInstallerFile);$(Templates22MSIInstallerFile);$(Templates21MSIInstallerFile);$(CombinedFrameworkSdkHostMSIInstallerFile);$(SdkPlaceholderMSIInstallerFile)" />
</ItemGroup>
<GenerateMsiVersion CommitCount="$(GitCommitCount)"
@ -84,6 +90,11 @@
PropertyName="Templates21InstallerUpgradeCode" />
</GenerateGuidFromName>
<GenerateGuidFromName Name="$(SdkPlaceholderMSIInstallerFile)">
<Output TaskParameter="OutputGuid"
PropertyName="SdkPlaceholderInstallerUpgradeCode" />
</GenerateGuidFromName>
<GenerateGuidFromName Name="$(SdkBundleInstallerOutputGuidString)">
<Output TaskParameter="OutputGuid"
PropertyName="CombinedFrameworkSDKHostInstallerUpgradeCode" />
@ -130,11 +141,31 @@
'$(SDKBundleVersion)' ^
'$(NugetVersion)' ^
'$(SdkInstallerUpgradeCode)' ^
'$(SdkDependencyKeyPrefix)' ^
'$(Architecture)' ^
'$(SdkStableFileIdForApphostTransform)' ^
-InformationAction Continue" />
</Target>
<Target Name="GenerateSdkPlaceholderMsi"
DependsOnTargets="AcquireWix;MsiTargetsSetupInputOutputs"
Condition=" '$(OS)' == 'Windows_NT' "
Inputs="$(SdkPlaceholderGenerateMsiPowershellScript)"
Outputs="$(SdkPlaceholderMSIInstallerFile)">
<Exec Command="powershell -NoProfile -NoLogo $(SdkPlaceholderGenerateMsiPowershellScript) ^
'$(SdkPlaceholderMSIInstallerFile)' ^
'$(WixRoot)' ^
'$(SdkBrandName)' ^
'$(MsiVersion)' ^
'$(SDKBundleVersion)' ^
'$(NugetVersion)' ^
'$(SdkPlaceholderInstallerUpgradeCode)' ^
'$(SdkPlaceholderDependencyKeyPrefix)' ^
'$(Architecture)' ^
-InformationAction Continue" />
</Target>
<Target Name="GenerateTemplatesMsis"
DependsOnTargets="GenerateLayout;AcquireWix;MsiTargetsSetupInputOutputs;SetSdkBrandingInfo;SetupTemplatesMsis"
Condition="$(ProductMonikerRid.StartsWith('win')) And !$(Architecture.StartsWith('arm'))"
@ -151,6 +182,7 @@
'@(TemplatesMsiComponent->'%(MsiVersion)')' ^
'$(FullNugetVersion)' ^
'@(TemplatesMsiComponent->'%(UpgradeCode)')' ^
'@(TemplatesMsiComponent->'%(DependencyKeyPrefix)')' ^
'$(Architecture)' ^
-InformationAction Continue" />
</Target>
@ -167,6 +199,7 @@
<BrandName>$(BundledTemplates30BrandName)</BrandName>
<MsiVersion>$(BundledTemplates30MsiVersion)</MsiVersion>
<UpgradeCode>$(Templates30InstallerUpgradeCode)</UpgradeCode>
<DependencyKeyPrefix>NetCore_Templates_3.0</DependencyKeyPrefix>
</TemplatesMsiComponent>
<TemplatesMsiComponent Include="NetCore22TemplatesMsi">
<LayoutPath>$(Templates22LayoutPath.TrimEnd('\'))</LayoutPath>
@ -174,6 +207,7 @@
<BrandName>$(BundledTemplates22BrandName)</BrandName>
<MsiVersion>$(BundledTemplates22MsiVersion)</MsiVersion>
<UpgradeCode>$(Templates22InstallerUpgradeCode)</UpgradeCode>
<DependencyKeyPrefix>NetCore_Templates_2.2</DependencyKeyPrefix>
</TemplatesMsiComponent>
<TemplatesMsiComponent Include="NetCore21TemplatesMsi">
<LayoutPath>$(Templates21LayoutPath.TrimEnd('\'))</LayoutPath>
@ -181,6 +215,7 @@
<BrandName>$(BundledTemplates21BrandName)</BrandName>
<MsiVersion>$(BundledTemplates21MsiVersion)</MsiVersion>
<UpgradeCode>$(Templates21InstallerUpgradeCode)</UpgradeCode>
<DependencyKeyPrefix>NetCore_Templates_2.1</DependencyKeyPrefix>
</TemplatesMsiComponent>
</ItemGroup>
</Target>
@ -216,6 +251,7 @@
'$(NugetVersion)' ^
'$(MicrosoftWindowsDesktopPackageVersion)' ^
'$(CombinedFrameworkSDKHostInstallerUpgradeCode)' ^
'$(SdkDependencyKeyPrefix)' ^
'$(Architecture)' ^
'$(MicrosoftNETCoreAppPackageVersion)' ^
'$(AspNetCoreVersion)' ^
@ -242,6 +278,24 @@
'$(SdkMSICabFile)'" />
</Target>
<Target Name="GenerateSdkPlaceholderNupkg"
DependsOnTargets="MsiTargetsSetupInputOutputs;GenerateSdkPlaceholderMsi;SignSdkPlaceholderMsi"
Condition=" '$(OS)' == 'Windows_NT' "
Inputs="$(SdkPlaceholderMSIInstallerFile);
$(SdkPlaceholderInstallerNuspecFile);
$(GenerateNupkgPowershellScript)"
Outputs="$(SdkPlaceholderInstallerNupkgFile)">
<Exec Command="powershell -NoProfile -NoLogo $(GenerateNupkgPowershellScript) ^
'$(ArtifactsDir)' ^
'$(SdkPlaceholderMSIInstallerFile)' ^
'$(FullNugetVersion)' ^
'$(SdkPlaceholderInstallerNuspecFile)' ^
'$(SdkPlaceholderInstallerNupkgFile)' ^
'$(Architecture)' ^
'$(MajorMinorVersion)'" />
</Target>
<Target Name="GenerateTemplatesNupkgs"
DependsOnTargets="GenerateLayout;MsiTargetsSetupInputOutputs;GenerateTemplatesMsis;SignTemplatesMsis;SetupTemplatesNupkgs"
Condition="$(ProductMonikerRid.StartsWith('win')) And !$(Architecture.StartsWith('arm'))"
@ -347,8 +401,11 @@
SignTemplatesMsis;
GenerateSdkBundle;
SignSdkBundle;
GenerateSdkPlaceholderMsi;
SignSdkPlaceholderMsi;
GenerateToolsetNupkg;
GenerateTemplatesNupkgs;
GenerateSdkPlaceholderNupkg;
GenerateVSToolsNupkg;
GenerateVSToolsResolverNupkg;
GenerateSdkMSBuildExtensionsNupkg"

View file

@ -254,4 +254,34 @@
MicroBuildCorePath="$(NuGetPackageRoot)microbuild.core\$(MicroBuildCoreVersion)"/>
</Target>
<Target Name="SignSdkPlaceholderMsi"
Condition="'$(SignCoreSdk)' == 'true'"
DependsOnTargets="SetSignProps">
<ItemGroup>
<SdkPlaceholderMsiFilesToSign Include="$(SdkPlaceholderMSIInstallerFile)" />
<SdkPlaceholderMsiFileSignInfo Include="@(SdkPlaceholderMsiFilesToSign->'%(Filename)%(Extension)')">
<CertificateName>$(InternalCertificateId)</CertificateName>
</SdkPlaceholderMsiFileSignInfo>
<DistinctSdkPlaceholderMsiFileSignInfo Include="@(SdkPlaceholderMsiFileSignInfo->Distinct())" />
</ItemGroup>
<Microsoft.DotNet.SignTool.SignToolTask
DryRun="$(_DryRun)"
TestSign="$(_TestSign)"
CertificatesSignInfo="$(CertificatesSignInfo)"
ItemsToSign="@(SdkPlaceholderMsiFilesToSign)"
StrongNameSignInfo="@(StrongNameSignInfo)"
FileSignInfo="@(DistinctSdkPlaceholderMsiFileSignInfo)"
FileExtensionSignInfo="@(FileExtensionSignInfo)"
TempDir="$(ArtifactsTmpDir)"
LogDir="$(ArtifactsLogDir)"
MSBuildPath="$(_DesktopMSBuildPath)"
SNBinaryPath="$(NuGetPackageRoot)sn\$(SNVersion)\sn.exe"
MicroBuildCorePath="$(NuGetPackageRoot)microbuild.core\$(MicroBuildCoreVersion)"/>
</Target>
</Project>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>VS.Redist.Common.NetCore.SdkPlaceholder.$ARCH$</id>
<version>1.0.0</version>
<title>VS.Redist.Common.NetCore.SdkPlaceholder.$ARCH$</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>https://www.microsoft.com/net/dotnet_library_license.htm</licenseUrl>
<projectUrl>https://github.com/dotnet/core-sdk</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>.NET Core $MAJOR_MINOR$ SDK ARP Placeholder ($ARCH$) Windows Installer MSI as a .nupkg for internal Visual Studio build consumption</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
</metadata>
<files>
<file src="$PAYLOAD_FILES$" />
</files>
</package>

View file

@ -23,6 +23,8 @@
<Feature Id="Provider" Absent="disallow" AllowAdvertise="no" Description="Used for Ref Counting" Display="hidden" Level="1" InstallDefault="local" Title="RefCounting" TypicalDefault="install">
<ComponentRef Id="$(var.DependencyKeyId)" />
</Feature>
<Property Id="ARPNOMODIFY" Value="1" />
<Property Id="ProductFamily" Value="$(var.ProductFamily)" />
<Property Id="ProductEdition" Value="$(var.ProductEdition)" />
<Property Id="ProductCPU" Value="$(var.Platform)" />

View file

@ -22,6 +22,7 @@ param(
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
[Parameter(Mandatory=$true)][string]$WindowsDesktopVersion,
[Parameter(Mandatory=$true)][string]$UpgradeCode,
[Parameter(Mandatory=$true)][string]$DependencyKeyPrefix,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$DotNetRuntimeVersion,
[Parameter(Mandatory=$true)][string]$AspNetCoreVersion,
@ -44,6 +45,7 @@ function RunCandleForBundle
-dSDKProductBandVersion="$SDKProductBandVersion" `
-dNugetVersion="$DotnetCLINugetVersion" `
-dCLISDKMsiSourcePath="$CLISDKMSIFile" `
-dDependencyKeyPrefix="$DependencyKeyPrefix" `
-dUpgradeCode="$UpgradeCode" `
-dSharedFXMsiSourcePath="$SharedFxMSIFile" `
-dHostFXRMsiSourcePath="$HostFxrMSIFile" `

View file

@ -10,6 +10,7 @@ param(
[Parameter(Mandatory=$true)][string]$SDKBundleVersion,
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
[Parameter(Mandatory=$true)][string]$UpgradeCode,
[Parameter(Mandatory=$true)][string]$DependencyKeyPrefix,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$StableFileIdForApphostTransform
)
@ -66,6 +67,7 @@ function RunCandle
-dSDKBundleVersion="$SDKBundleVersion" `
-dNugetVersion="$DotnetCLINugetVersion" `
-dUpgradeCode="$UpgradeCode" `
-dDependencyKeyPrefix="$DependencyKeyPrefix" `
-arch "$Architecture" `
-ext WixDependencyExtension.dll `
"$PSScriptRoot\dotnet.wxs" `

View file

@ -0,0 +1,105 @@
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
param(
[Parameter(Mandatory=$true)][string]$DotnetMSIOutput,
[Parameter(Mandatory=$true)][string]$WixRoot,
[Parameter(Mandatory=$true)][string]$ProductMoniker,
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
[Parameter(Mandatory=$true)][string]$SDKBundleVersion,
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
[Parameter(Mandatory=$true)][string]$UpgradeCode,
[Parameter(Mandatory=$true)][string]$DependencyKeyPrefix,
[Parameter(Mandatory=$true)][string]$Architecture
)
function RunCandle
{
$result = $true
pushd "$WixRoot"
Write-Information "Running candle.."
$candleOutput = .\candle.exe -nologo `
-dDotnetSrc="$inputDir" `
-dMicrosoftEula="$PSScriptRoot\clisdk\dummyeula.rtf" `
-dProductMoniker="$ProductMoniker" `
-dBuildVersion="$DotnetMSIVersion" `
-dSDKBundleVersion="$SDKBundleVersion" `
-dNugetVersion="$DotnetCLINugetVersion" `
-dUpgradeCode="$UpgradeCode" `
-dDependencyKeyPrefix="$DependencyKeyPrefix" `
-arch "$Architecture" `
-ext WixDependencyExtension.dll `
"$PSScriptRoot\sdkplaceholder.wxs" `
"$PSScriptRoot\provider.wxs"
Write-Information "Candle output: $candleOutput"
if($LastExitCode -ne 0)
{
$result = $false
Write-Information "Candle failed with exit code $LastExitCode."
}
popd
return $result
}
function RunLight
{
$result = $true
pushd "$WixRoot"
Write-Information "Running light.."
$CabCache = Join-Path $WixRoot "cabcache"
$lightOutput = .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
-cultures:en-us `
sdkplaceholder.wixobj `
provider.wixobj `
-b "$PSScriptRoot" `
-reusecab `
-cc "$CabCache" `
-out $DotnetMSIOutput
Write-Information "Light output: $lightOutput"
if($LastExitCode -ne 0)
{
$result = $false
Write-Information "Light failed with exit code $LastExitCode."
}
popd
return $result
}
Write-Information "Creating SdkPlaceholder MSI at $DotnetMSIOutput"
if([string]::IsNullOrEmpty($WixRoot))
{
Exit -1
}
if(-Not (RunCandle))
{
Write-Information "Candle failed"
Exit -1
}
if(-Not (RunLight))
{
Write-Information "Light failed"
Exit -1
}
if(!(Test-Path $DotnetMSIOutput))
{
throw "Unable to create the SdkPlaceholder MSI."
Exit -1
}
Write-Information "Successfully created SdkPlaceholder MSI - $DotnetMSIOutput"
exit $LastExitCode

View file

@ -10,6 +10,7 @@ param(
[Parameter(Mandatory=$true)][string]$SDKBundleVersion,
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
[Parameter(Mandatory=$true)][string]$UpgradeCode,
[Parameter(Mandatory=$true)][string]$DependencyKeyPrefix,
[Parameter(Mandatory=$true)][string]$Architecture
)
@ -59,6 +60,7 @@ function RunCandle
-dSDKBundleVersion="$SDKBundleVersion" `
-dNugetVersion="$DotnetCLINugetVersion" `
-dUpgradeCode="$UpgradeCode" `
-dDependencyKeyPrefix="$DependencyKeyPrefix" `
-arch "$Architecture" `
-ext WixDependencyExtension.dll `
"$PSScriptRoot\templates.wxs" `

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?include "Variables.wxi" ?>
<Product Id="*" Name="$(var.ProductName) from Visual Studio" Language="$(var.ProductLanguage)" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package Compressed="yes" InstallScope="perMachine" InstallerVersion="200" />
<Condition Message="$(var.ProductName) must be installed as part of a coordinated SDK installation.">
Installed OR ALLOWMSIINSTALL
</Condition>
<Condition Message="$(var.ProductName) was installed with Visual Studio. If you wish to uninstall, use the Visual Studio Installer and select: &apos;Modify&apos;">
NOT Installed OR ALLOWMSIUNINSTALL
</Condition>
<MajorUpgrade DowngradeErrorMessage="$(var.DowngradeErrorMessage)" Schedule="afterInstallInitialize"/>
<Feature Id="Provider" Absent="disallow" AllowAdvertise="no" Description="Used for Ref Counting" Display="hidden" Level="1" InstallDefault="local" Title="RefCounting" TypicalDefault="install">
<ComponentRef Id="$(var.DependencyKeyId)" />
</Feature>
<Property Id="ARPNOMODIFY" Value="1" />
<Property Id="ProductFamily" Value="$(var.ProductFamily)" />
<Property Id="ProductEdition" Value="$(var.ProductEdition)" />
<Property Id="ProductCPU" Value="$(var.Platform)" />
<Property Id="RTM_ProductVersion" Value="$(var.Dotnet_ProductVersion)" />
<Property Id="MSIFASTINSTALL" Value="7" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.MicrosoftEula)" />
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir" />
</Fragment>
</Wix>

View file

@ -30,6 +30,6 @@
<?error Invalid Platform ($(var.Platform))?>
<?endif?>
<?define DependencyKey = "Dotnet_CLI_$(var.SDKBundleVersion)_$(var.Platform)"?>
<?define DependencyKey = "$(var.DependencyKeyPrefix)_$(var.SDKBundleVersion)_$(var.Platform)"?>
<?define DependencyKeyId = "$(var.DependencyKey)" ?>
</Include>