From a396550ed06a06bb21279e9495dbcf3c3348c78b Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 27 Jun 2017 16:49:34 -0700 Subject: [PATCH] Adding a installer for Downlevel (Dev14) to install .NET Framework props and targets to enable it to reference netstandard 2.0. --- build/Branding.props | 3 +- build/InstallerInfo.props | 2 + build/package/Archive.targets | 2 +- build/package/Installer.MSI.targets | 29 ++++ build/package/Layout.targets | 27 ++++ .../windows/msbuildextensions/generatemsi.ps1 | 140 ++++++++++++++++++ .../msbuildextensions/msbuildextensions.wxs | 34 +++++ .../windows/msbuildextensions/provider.wxs | 9 ++ .../msbuildextensions/registrykeys.wxs | 13 ++ .../windows/msbuildextensions/variables.wxi | 23 +++ 10 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 packaging/windows/msbuildextensions/generatemsi.ps1 create mode 100644 packaging/windows/msbuildextensions/msbuildextensions.wxs create mode 100644 packaging/windows/msbuildextensions/provider.wxs create mode 100644 packaging/windows/msbuildextensions/registrykeys.wxs create mode 100644 packaging/windows/msbuildextensions/variables.wxi diff --git a/build/Branding.props b/build/Branding.props index 913041dac..4624ef7ed 100644 --- a/build/Branding.props +++ b/build/Branding.props @@ -1,6 +1,7 @@ Microsoft .NET Core SDK - 2.0.0 Preview 2 + Microsoft .NET Core MSBuild Extensions - 2.0.0 Preview 2 Microsoft .NET Core Runtime - 2.0.0 Microsoft .NET Core Host - 2.0.0 Microsoft .NET Core Host FX Resolver - 2.0.0 @@ -24,7 +25,7 @@ dotnet-sdk $(ArtifactNameSdk)-$(SdkVersion)-$(ProductMonikerRid) - + dotnet-msbuild-extensions-$(SdkVersion)-$(ProductMonikerRid) $(ArtifactNameSdkDebug)-$(SdkVersion)-$(ProductMonikerRid) $(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(ProductMonikerRid) diff --git a/build/InstallerInfo.props b/build/InstallerInfo.props index 6cc81f094..036369fab 100644 --- a/build/InstallerInfo.props +++ b/build/InstallerInfo.props @@ -2,11 +2,13 @@ $(PackagesDirectory) $(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension) + $(InstallerOutputDirectory)/$(ArtifactNameWithVersionMSBuildExtensions)$(InstallerExtension) $(InstallerOutputDirectory)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension) $(IntermediateDirectory)/debian/sdk $(SdkDebianIntermediateDirectory)/debianLayoutDirectory $(IntermediateDirectory)/layouts $(LayoutDirectory)/$(ArtifactNameSdk) + $(LayoutDirectory)/MSBuildExtensions diff --git a/build/package/Archive.targets b/build/package/Archive.targets index 54352ae27..901423bd2 100644 --- a/build/package/Archive.targets +++ b/build/package/Archive.targets @@ -37,7 +37,7 @@ - + %(LayoutDefinition.OutputFiles) $(ArchiveOutputDirectory)/%(LayoutDefinition.NameWithVersion)$(ArchiveExtension) $(LayoutDirectory)/%(LayoutDefinition.Name) diff --git a/build/package/Installer.MSI.targets b/build/package/Installer.MSI.targets index 44f930c8b..2a4e131b8 100644 --- a/build/package/Installer.MSI.targets +++ b/build/package/Installer.MSI.targets @@ -17,6 +17,8 @@ $(RepoRoot)/packaging/windows/clisdk/generatebundle.ps1 $(RepoRoot)/packaging/windows/clisdk/generatenupkg.ps1 + $(RepoRoot)/packaging/windows/msbuildextensions/generatemsi.ps1 + $(RepoRoot)/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec $(InstallerOutputDirectory)/VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg @@ -36,11 +38,14 @@ + + + + + + @@ -103,6 +113,24 @@ '$(Architecture)'" /> + + + + + + + + + + + + + + + + + + + + + + @@ -53,7 +74,13 @@ $(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk) $(ArtifactNameCombinedHostHostFxrFrameworkSdk) + + + + @(CombinedMSBuildExtensionsInput) + @(CombinedMSBuildExtensionsRelativeOutputFiles -> '$(MSBuildExtensionsOutputDirectory)/%(Identity)') + diff --git a/packaging/windows/msbuildextensions/generatemsi.ps1 b/packaging/windows/msbuildextensions/generatemsi.ps1 new file mode 100644 index 000000000..84ca7462e --- /dev/null +++ b/packaging/windows/msbuildextensions/generatemsi.ps1 @@ -0,0 +1,140 @@ +# 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]$inputDir, + [Parameter(Mandatory=$true)][string]$MSBuildExtensionsMSIOutput, + [Parameter(Mandatory=$true)][string]$WixRoot, + [Parameter(Mandatory=$true)][string]$ProductMoniker, + [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, + [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion, + [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion, + [Parameter(Mandatory=$true)][string]$UpgradeCode, + [Parameter(Mandatory=$true)][string]$Architecture +) + +. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." + +$InstallFileswsx = "install-files.wxs" +$InstallFilesWixobj = "install-files.wixobj" + +function RunHeat +{ + $result = $true + pushd "$WixRoot" + + Write-Output Running heat.. + + .\heat.exe dir `"$inputDir`" -template fragment -sreg -gg -var var.DotnetSrc -cg InstallFiles -srd -dr MSBUILDEXTENSIONSHOME -out $InstallFileswsx | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Output "Heat failed with exit code $LastExitCode." + } + + popd + return $result +} + +function RunCandle +{ + $result = $true + pushd "$WixRoot" + + Write-Output Running candle.. + $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions" + + .\candle.exe -nologo ` + -dDotnetSrc="$inputDir" ` + -dMicrosoftEula="$RepoRoot\packaging\windows\clisdk\dummyeula.rtf" ` + -dProductMoniker="$ProductMoniker" ` + -dBuildVersion="$DotnetMSIVersion" ` + -dDisplayVersion="$DotnetCLIDisplayVersion" ` + -dNugetVersion="$DotnetCLINugetVersion" ` + -dUpgradeCode="$UpgradeCode" ` + -arch "$Architecture" ` + -ext WixDependencyExtension.dll ` + "$AuthWsxRoot\msbuildextensions.wxs" ` + "$AuthWsxRoot\provider.wxs" ` + "$AuthWsxRoot\registrykeys.wxs" ` + $InstallFileswsx | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Output "Candle failed with exit code $LastExitCode." + } + + popd + return $result +} + +function RunLight +{ + $result = $true + pushd "$WixRoot" + + Write-Output Running light.. + $CabCache = Join-Path $WixRoot "cabcache" + $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions" + + .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` + -cultures:en-us ` + msbuildextensions.wixobj ` + provider.wixobj ` + registrykeys.wixobj ` + $InstallFilesWixobj ` + -b "$inputDir" ` + -b "$AuthWsxRoot" ` + -reusecab ` + -cc "$CabCache" ` + -out $MSBuildExtensionsMSIOutput | Out-Host + + if($LastExitCode -ne 0) + { + $result = $false + Write-Output "Light failed with exit code $LastExitCode." + } + + popd + return $result +} + +if(!(Test-Path $inputDir)) +{ + throw "$inputDir not found" +} + +Write-Output "Creating MSBuild Extensions MSI at $MSBuildExtensionsMSIOutput" + +if([string]::IsNullOrEmpty($WixRoot)) +{ + Exit -1 +} + +if(-Not (RunHeat)) +{ + Exit -1 +} + +if(-Not (RunCandle)) +{ + Exit -1 +} + +if(-Not (RunLight)) +{ + Exit -1 +} + +if(!(Test-Path $MSBuildExtensionsMSIOutput)) +{ + throw "Unable to create the MSBuild Extensions msi." + Exit -1 +} + +Write-Output -ForegroundColor Green "Successfully created MSBuild Extensions MSI - $MSBuildExtensionsMSIOutput" + +exit $LastExitCode diff --git a/packaging/windows/msbuildextensions/msbuildextensions.wxs b/packaging/windows/msbuildextensions/msbuildextensions.wxs new file mode 100644 index 000000000..9cfa987fa --- /dev/null +++ b/packaging/windows/msbuildextensions/msbuildextensions.wxs @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/windows/msbuildextensions/provider.wxs b/packaging/windows/msbuildextensions/provider.wxs new file mode 100644 index 000000000..e1711ec76 --- /dev/null +++ b/packaging/windows/msbuildextensions/provider.wxs @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packaging/windows/msbuildextensions/registrykeys.wxs b/packaging/windows/msbuildextensions/registrykeys.wxs new file mode 100644 index 000000000..fde60d74a --- /dev/null +++ b/packaging/windows/msbuildextensions/registrykeys.wxs @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/windows/msbuildextensions/variables.wxi b/packaging/windows/msbuildextensions/variables.wxi new file mode 100644 index 000000000..fb23aef1a --- /dev/null +++ b/packaging/windows/msbuildextensions/variables.wxi @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + +