Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit a396550

Browse files
author
Livar Cunha
committed
Adding a installer for Downlevel (Dev14) to install .NET Framework props and targets to enable it to reference netstandard 2.0.
1 parent 262c9d9 commit a396550

File tree

10 files changed

+280
-2
lines changed

10 files changed

+280
-2
lines changed

build/Branding.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project ToolsVersion="14.0">
22
<PropertyGroup>
33
<SdkBrandName>Microsoft .NET Core SDK - 2.0.0 Preview 2</SdkBrandName>
4+
<MSBuildExtensionsBrandName>Microsoft .NET Core MSBuild Extensions - 2.0.0 Preview 2</MSBuildExtensionsBrandName>
45
<SharedFrameworkBrandName>Microsoft .NET Core Runtime - 2.0.0</SharedFrameworkBrandName>
56
<SharedHostBrandName>Microsoft .NET Core Host - 2.0.0</SharedHostBrandName>
67
<HostFxrBrandName>Microsoft .NET Core Host FX Resolver - 2.0.0</HostFxrBrandName>
@@ -24,7 +25,7 @@
2425
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk</ArtifactNameCombinedHostHostFxrFrameworkSdk>
2526

2627
<ArtifactNameWithVersionSdk>$(ArtifactNameSdk)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionSdk>
27-
28+
<ArtifactNameWithVersionMSBuildExtensions>dotnet-msbuild-extensions-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionMSBuildExtensions>
2829

2930
<ArtifactNameWithVersionSdkDebug>$(ArtifactNameSdkDebug)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionSdkDebug>
3031
<ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(SdkVersion)-$(ProductMonikerRid)</ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>

build/InstallerInfo.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
<PropertyGroup>
33
<InstallerOutputDirectory>$(PackagesDirectory)</InstallerOutputDirectory>
44
<SdkInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionSdk)$(InstallerExtension)</SdkInstallerFile>
5+
<MSBuildExtensionsInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionMSBuildExtensions)$(InstallerExtension)</MSBuildExtensionsInstallerFile>
56
<CombinedFrameworkSdkHostInstallerFile>$(InstallerOutputDirectory)/$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)$(BundleExtension)</CombinedFrameworkSdkHostInstallerFile>
67

78
<SdkDebianIntermediateDirectory>$(IntermediateDirectory)/debian/sdk</SdkDebianIntermediateDirectory>
89
<LayoutDirectory Condition=" '$(OSName)' == 'ubuntu' OR '$(OSName)' == 'debian' ">$(SdkDebianIntermediateDirectory)/debianLayoutDirectory</LayoutDirectory>
910
<LayoutDirectory Condition=" '$(OSName)' != 'ubuntu' AND '$(OSName)' != 'debian' ">$(IntermediateDirectory)/layouts</LayoutDirectory>
1011
<SdkLayoutOutputDirectory>$(LayoutDirectory)/$(ArtifactNameSdk)</SdkLayoutOutputDirectory>
12+
<MSBuildExtensionsOutputDirectory>$(LayoutDirectory)/MSBuildExtensions</MSBuildExtensionsOutputDirectory>
1113
</PropertyGroup>
1214
</Project>

build/package/Archive.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<Target Name="SetupGenerateArchivesInputsOutputs"
3838
DependsOnTargets="Init">
3939
<ItemGroup>
40-
<GenerateArchivesInputsOutputs Include="%(LayoutDefinition.Name)">
40+
<GenerateArchivesInputsOutputs Condition=" '%(LayoutDefinition.Name)' != '' " Include="%(LayoutDefinition.Name)">
4141
<Inputs>%(LayoutDefinition.OutputFiles)</Inputs>
4242
<Outputs>$(ArchiveOutputDirectory)/%(LayoutDefinition.NameWithVersion)$(ArchiveExtension)</Outputs>
4343
<InputDirectory>$(LayoutDirectory)/%(LayoutDefinition.Name)</InputDirectory>

build/package/Installer.MSI.targets

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<SdkGenerateBundlePowershellScript>$(RepoRoot)/packaging/windows/clisdk/generatebundle.ps1</SdkGenerateBundlePowershellScript>
1818
<SdkGenerateNupkgPowershellScript>$(RepoRoot)/packaging/windows/clisdk/generatenupkg.ps1</SdkGenerateNupkgPowershellScript>
1919

20+
<MSBuildExtensionsGenerateMsiPowershellScript>$(RepoRoot)/packaging/windows/msbuildextensions/generatemsi.ps1</MSBuildExtensionsGenerateMsiPowershellScript>
21+
2022
<SdkInstallerNuspecFile>$(RepoRoot)/packaging/windows/clisdk/VS.Redist.Common.Net.Core.SDK.$(Architecture).nuspec</SdkInstallerNuspecFile>
2123
<SdkInstallerNupkgFile>$(InstallerOutputDirectory)/VS.Redist.Common.Net.Core.SDK.$(Architecture).$(FullNugetVersion).nupkg</SdkInstallerNupkgFile>
2224

@@ -36,11 +38,14 @@
3638
<ItemGroup>
3739
<GenerateSdkMsiInputs Include="$(SdkLayoutOutputDirectory)/**/*;
3840
$(SdkGenerateMsiPowershellScript)" />
41+
<GenerateMSBuildExtensionsMsiInputs Include="$(MSBuildExtensionsOutputDirectory)/**/*;
42+
$(MSBuildExtensionsGenerateMsiPowershellScript)" />
3943
</ItemGroup>
4044

4145
<!-- Consumed By Publish -->
4246
<ItemGroup>
4347
<GeneratedInstallers Include="$(SdkInstallerFile);$(CombinedFrameworkSdkHostInstallerFile)" />
48+
<GeneratedInstallers Condition=" '$(Architecture)' == 'x86' " Include="$(MSBuildExtensionsInstallerFile)" />
4449
</ItemGroup>
4550

4651
<GenerateMsiVersion CommitCount="$(CommitCount)"
@@ -55,6 +60,11 @@
5560
PropertyName="SdkInstallerUpgradeCode" />
5661
</GenerateGuidFromName>
5762

63+
<GenerateGuidFromName Name="$(MSBuildExtensionsInstallerFile)">
64+
<Output TaskParameter="OutputGuid"
65+
PropertyName="MSBuildExtensionsInstallerUpgradeCode" />
66+
</GenerateGuidFromName>
67+
5868
<GenerateGuidFromName Name="$(CombinedFrameworkSdkHostInstallerFile)">
5969
<Output TaskParameter="OutputGuid"
6070
PropertyName="CombinedFrameworkSDKHostInstallerUpgradeCode" />
@@ -103,6 +113,24 @@
103113
'$(Architecture)'" />
104114
</Target>
105115

116+
<Target Name="GenerateMSBuildExtensionsMsi"
117+
DependsOnTargets="Init;Layout;AcquireWix;MsiTargetsSetupInputOutputs"
118+
Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x86' "
119+
Inputs="@(GenerateMSBuildExtensionsMsiInputs)"
120+
Outputs="$(MSBuildExtensionsInstallerFile)">
121+
122+
<Exec Command="powershell -NoProfile -NoLogo $(MSBuildExtensionsGenerateMsiPowershellScript)
123+
'$(MSBuildExtensionsOutputDirectory)'
124+
'$(MSBuildExtensionsInstallerFile)'
125+
'$(WixRoot)'
126+
'$(MSBuildExtensionsBrandName)'
127+
'$(SimpleVersion)'
128+
'$(SimpleVersion)'
129+
'$(NugetVersion)'
130+
'$(MSBuildExtensionsInstallerUpgradeCode)'
131+
'$(Architecture)'" />
132+
</Target>
133+
106134
<Target Name="GenerateSdkBundle"
107135
DependsOnTargets="Init;Layout;AcquireWix;MsiTargetsSetupInputOutputs;GenerateSdkMsi"
108136
Condition=" '$(OS)' == 'Windows_NT'"
@@ -186,6 +214,7 @@
186214
MsiTargetsSetupInputOutputs;
187215
AcquireWix;
188216
GenerateSdkMsi;
217+
GenerateMSBuildExtensionsMsi;
189218
GenerateSdkBundle;
190219
GenerateSdkNupkg;
191220
GenerateSdkMSBuildExtensionsNupkg;

build/package/Layout.targets

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
<CombinedHostHostFxrFrameworkSdkInput Include="$(OutputDirectory)/**/*" />
1414

1515
<AspNetRuntimeFilesInput Include="$(AspNetRuntimePackageStorePublishDirectory)/**/*" />
16+
17+
<MSBuildExtensionsInput Include="$(MSBuildExtensionsLayoutDirectory)/msbuildExtensions/**/*" />
18+
<MSBuildExtensionsVerInput Include="$(MSBuildExtensionsLayoutDirectory)/msbuildExtensions-ver/**/*" />
19+
<CombinedMSBuildExtensionsInput Include="@(MSBuildExtensionsInput)" />
20+
<CombinedMSBuildExtensionsInput Include="@(MSBuildExtensionsVerInput)" />
1621
</ItemGroup>
1722

1823
<MakeRelative
@@ -31,6 +36,22 @@
3136
<Output TaskParameter="RelativePath" ItemName="CombinedHostHostFxrFrameworkSdkRelativeOutputFiles" />
3237
</MakeRelative>
3338

39+
<MakeRelative
40+
Path1="$(MSBuildExtensionsLayoutDirectory)/msbuildExtensions/"
41+
Path2="%(MSBuildExtensionsInput.Identity)" >
42+
<Output TaskParameter="RelativePath" ItemName="MSBuildExtensionsRelativeOutputFiles" />
43+
</MakeRelative>
44+
<MakeRelative
45+
Path1="$(MSBuildExtensionsLayoutDirectory)/msbuildExtensions-ver/"
46+
Path2="%(MSBuildExtensionsVerInput.Identity)" >
47+
<Output TaskParameter="RelativePath" ItemName="MSBuildExtensionsVerRelativeOutputFiles" />
48+
</MakeRelative>
49+
50+
<ItemGroup>
51+
<CombinedMSBuildExtensionsRelativeOutputFiles Include="@(MSBuildExtensionsRelativeOutputFiles)" />
52+
<CombinedMSBuildExtensionsRelativeOutputFiles Include="@(MSBuildExtensionsVerRelativeOutputFiles -> '14.0/%(Identity)')" />
53+
</ItemGroup>
54+
3455
<!-- Set up Items Defining Layouts for easy change -->
3556
<ItemGroup>
3657
<LayoutDefinition Include="Sdk">
@@ -53,7 +74,13 @@
5374
<NameWithVersion>$(ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk)</NameWithVersion>
5475
<Name>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)</Name>
5576
</LayoutDefinition>
77+
</ItemGroup>
5678

79+
<ItemGroup Condition=" '$(OS)' == 'Windows_NT' And '$(Architecture)' == 'x86' ">
80+
<LayoutDefinition Include="MSBuildExtensions">
81+
<InputFiles>@(CombinedMSBuildExtensionsInput)</InputFiles>
82+
<OutputFiles>@(CombinedMSBuildExtensionsRelativeOutputFiles -> '$(MSBuildExtensionsOutputDirectory)/%(Identity)')</OutputFiles>
83+
</LayoutDefinition>
5784
</ItemGroup>
5885
</Target>
5986

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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]$MSBuildExtensionsMSIOutput,
7+
[Parameter(Mandatory=$true)][string]$WixRoot,
8+
[Parameter(Mandatory=$true)][string]$ProductMoniker,
9+
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
10+
[Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion,
11+
[Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion,
12+
[Parameter(Mandatory=$true)][string]$UpgradeCode,
13+
[Parameter(Mandatory=$true)][string]$Architecture
14+
)
15+
16+
. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1"
17+
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
18+
19+
$InstallFileswsx = "install-files.wxs"
20+
$InstallFilesWixobj = "install-files.wixobj"
21+
22+
function RunHeat
23+
{
24+
$result = $true
25+
pushd "$WixRoot"
26+
27+
Write-Output Running heat..
28+
29+
.\heat.exe dir `"$inputDir`" -template fragment -sreg -gg -var var.DotnetSrc -cg InstallFiles -srd -dr MSBUILDEXTENSIONSHOME -out $InstallFileswsx | Out-Host
30+
31+
if($LastExitCode -ne 0)
32+
{
33+
$result = $false
34+
Write-Output "Heat failed with exit code $LastExitCode."
35+
}
36+
37+
popd
38+
return $result
39+
}
40+
41+
function RunCandle
42+
{
43+
$result = $true
44+
pushd "$WixRoot"
45+
46+
Write-Output Running candle..
47+
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions"
48+
49+
.\candle.exe -nologo `
50+
-dDotnetSrc="$inputDir" `
51+
-dMicrosoftEula="$RepoRoot\packaging\windows\clisdk\dummyeula.rtf" `
52+
-dProductMoniker="$ProductMoniker" `
53+
-dBuildVersion="$DotnetMSIVersion" `
54+
-dDisplayVersion="$DotnetCLIDisplayVersion" `
55+
-dNugetVersion="$DotnetCLINugetVersion" `
56+
-dUpgradeCode="$UpgradeCode" `
57+
-arch "$Architecture" `
58+
-ext WixDependencyExtension.dll `
59+
"$AuthWsxRoot\msbuildextensions.wxs" `
60+
"$AuthWsxRoot\provider.wxs" `
61+
"$AuthWsxRoot\registrykeys.wxs" `
62+
$InstallFileswsx | Out-Host
63+
64+
if($LastExitCode -ne 0)
65+
{
66+
$result = $false
67+
Write-Output "Candle failed with exit code $LastExitCode."
68+
}
69+
70+
popd
71+
return $result
72+
}
73+
74+
function RunLight
75+
{
76+
$result = $true
77+
pushd "$WixRoot"
78+
79+
Write-Output Running light..
80+
$CabCache = Join-Path $WixRoot "cabcache"
81+
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions"
82+
83+
.\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
84+
-cultures:en-us `
85+
msbuildextensions.wixobj `
86+
provider.wixobj `
87+
registrykeys.wixobj `
88+
$InstallFilesWixobj `
89+
-b "$inputDir" `
90+
-b "$AuthWsxRoot" `
91+
-reusecab `
92+
-cc "$CabCache" `
93+
-out $MSBuildExtensionsMSIOutput | Out-Host
94+
95+
if($LastExitCode -ne 0)
96+
{
97+
$result = $false
98+
Write-Output "Light failed with exit code $LastExitCode."
99+
}
100+
101+
popd
102+
return $result
103+
}
104+
105+
if(!(Test-Path $inputDir))
106+
{
107+
throw "$inputDir not found"
108+
}
109+
110+
Write-Output "Creating MSBuild Extensions MSI at $MSBuildExtensionsMSIOutput"
111+
112+
if([string]::IsNullOrEmpty($WixRoot))
113+
{
114+
Exit -1
115+
}
116+
117+
if(-Not (RunHeat))
118+
{
119+
Exit -1
120+
}
121+
122+
if(-Not (RunCandle))
123+
{
124+
Exit -1
125+
}
126+
127+
if(-Not (RunLight))
128+
{
129+
Exit -1
130+
}
131+
132+
if(!(Test-Path $MSBuildExtensionsMSIOutput))
133+
{
134+
throw "Unable to create the MSBuild Extensions msi."
135+
Exit -1
136+
}
137+
138+
Write-Output -ForegroundColor Green "Successfully created MSBuild Extensions MSI - $MSBuildExtensionsMSIOutput"
139+
140+
exit $LastExitCode
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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="200" />
6+
7+
<MajorUpgrade DowngradeErrorMessage="$(var.DowngradeErrorMessage)" Schedule="afterInstallInitialize"/>
8+
9+
<MediaTemplate CabinetTemplate="dnet-{0}.cab" CompressionLevel="high" />
10+
11+
<Feature Id="MainFeature" Title="Main Feature" Level="1">
12+
<ComponentGroupRef Id="InstallFiles" />
13+
<ComponentGroupRef Id="AuthoredRegistryKeys"/>
14+
</Feature>
15+
<Feature Id="Provider" Absent="disallow" AllowAdvertise="no" Description="Used for Ref Counting" Display="hidden" Level="1" InstallDefault="local" Title="RefCounting" TypicalDefault="install">
16+
<ComponentRef Id="$(var.DependencyKeyId)" />
17+
</Feature>
18+
<Property Id="ProductFamily" Value="$(var.ProductFamily)" />
19+
<Property Id="ProductEdition" Value="$(var.ProductEdition)" />
20+
<Property Id="ProductCPU" Value="$(var.Platform)" />
21+
<Property Id="RTM_ProductVersion" Value="$(var.Dotnet_ProductVersion)" />
22+
<Property Id="MSIFASTINSTALL" Value="7" />
23+
<WixVariable Id="WixUILicenseRtf" Value="$(var.MicrosoftEula)" />
24+
25+
<CustomActionRef Id="WixBroadcastEnvironmentChange" />
26+
</Product>
27+
<Fragment>
28+
<Directory Id="TARGETDIR" Name="SourceDir">
29+
<Directory Id="$(var.Program_Files)">
30+
<Directory Id="MSBUILDEXTENSIONSHOME" Name="MSBuild"/>
31+
</Directory>
32+
</Directory>
33+
</Fragment>
34+
</Wix>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension">
3+
<?include "Variables.wxi" ?>
4+
<Fragment>
5+
<Component Id="$(var.DependencyKeyId)" Directory="TARGETDIR" Win64="no" Guid="*">
6+
<dep:Provides Key="$(var.DependencyKey)" />
7+
</Component>
8+
</Fragment>
9+
</Wix>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3+
<?include "Variables.wxi" ?>
4+
<Fragment>
5+
<ComponentGroup Id="AuthoredRegistryKeys">
6+
<Component Id="SetupRegistry_x86" Directory="TARGETDIR" Win64="no">
7+
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\MSBuildExtensions">
8+
<RegistryValue Action="write" Name="$(var.NugetVersion)" Type="integer" Value="1" KeyPath="yes"/>
9+
</RegistryKey>
10+
</Component>
11+
</ComponentGroup>
12+
</Fragment>
13+
</Wix>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
3+
<?define Servicing_Key_SP = "0" ?>
4+
<?define Servicing_Key_SPIndex = "0" ?>
5+
<?define Servicing_Key_SPName = "Beta" ?>
6+
<?define Dotnet_ProductVersion = "$(var.BuildVersion)" ?>
7+
<?define Dotnet_DisplayVersion = "$(var.DisplayVersion)" ?>
8+
<?define Dotnet_BuildVersion = "$(var.BuildVersion)" ?>
9+
<?define Manufacturer = "Microsoft Corporation" ?>
10+
<?define ProductName = "$(var.ProductMoniker) ($(sys.BUILDARCH))" ?>
11+
<?define ProductLanguage = "1033" ?>
12+
<?define ProductVersion = "$(var.Dotnet_ProductVersion)" ?>
13+
<?define ProductFamily = "dotnet" ?>
14+
<?define ProductEdition = "001dotnet" ?>
15+
<?define LCID = "$(var.ProductLanguage)"?>
16+
<?define DowngradeErrorMessage = "A newer version is already installed; please uninstall it and re-run setup."?>
17+
18+
<?define Program_Files="ProgramFilesFolder"?>
19+
<?define Win64AttributeValue=no?>
20+
21+
<?define DependencyKey = "Dotnet_MSBUILD_EXTENSIONS_$(var.Dotnet_DisplayVersion)_$(var.Platform)"?>
22+
<?define DependencyKeyId = "$(var.DependencyKey)" ?>
23+
</Include>

0 commit comments

Comments
 (0)