forked from dotnet/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wix.targets
124 lines (107 loc) · 7.18 KB
/
Wix.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<Project>
<!-- Set versioning properties after Arcade SDK targets have been imported. -->
<PropertyGroup>
<!-- Actual upgrade code used in bundles to ensure upgrades withing a version band, e.g. 3.0.0.xxx -->
<_FileRevisionVersion>$(VersionSuffixDateStamp)</_FileRevisionVersion>
<_FileRevisionVersion Condition=" '$(_FileRevisionVersion)' == '' ">42424</_FileRevisionVersion>
<BundleVersion Condition="'$(BundleVersion)' != ''" >$(BundleVersion).$(_FileRevisionVersion)</BundleVersion>
<BundleVersion Condition="'$(BundleVersion)' == ''" >$(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion).$(_FileRevisionVersion)</BundleVersion>
<!-- Used for generating stable upgrade codes for bundles -->
<Version>$(BundleVersion)</Version>
<!-- ARM64 MSIs require the installer version to be at least 500. -->
<!-- See: https://docs.microsoft.com/en-us/windows/win32/msi/64-bit-windows-installer-packages -->
<DefineConstants Condition=" '$(Platform)' == 'arm64' ">$(DefineConstants);InstallerVersion=500</DefineConstants>
<DefineConstants Condition=" '$(Platform)' != 'arm64' ">$(DefineConstants);InstallerVersion=200</DefineConstants>
<DefineConstants>$(DefineConstants);MajorVersion=$(AspNetCoreMajorVersion)</DefineConstants>
<DefineConstants>$(DefineConstants);MinorVersion=$(AspNetCoreMinorVersion)</DefineConstants>
<DefineConstants>$(DefineConstants);Version=$(Version)</DefineConstants>
<DefineConstants>$(DefineConstants);PackageVersion=$(PackageVersion)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(OutputType)' == 'package'">
<InstallDir>$(ProductName)</InstallDir>
<DepProviderKey>Microsoft.$(ProductNameShort)_$(Platform)_$(Lang),v$(_GeneratedPackageVersion)</DepProviderKey>
<DefineConstants>$(DefineConstants);DepProviderKey=$(DepProviderKey)</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<GuidInputs>$(Version);$(Platform);$(VersionSuffix)</GuidInputs>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Installers" Version="$(MicrosoftDotNetBuildTasksInstallersVersion)" />
</ItemGroup>
<PropertyGroup>
<MicrosoftDotNetBuildTasksInstallersTaskAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(NuGetPackageRoot)microsoft.dotnet.build.tasks.installers\$(MicrosoftDotNetBuildTasksInstallersVersion)\tools\netcoreapp2.1\Microsoft.DotNet.Build.Tasks.Installers.dll</MicrosoftDotNetBuildTasksInstallersTaskAssembly>
<MicrosoftDotNetBuildTasksInstallersTaskAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(NuGetPackageRoot)microsoft.dotnet.build.tasks.installers\$(MicrosoftDotNetBuildTasksInstallersVersion)\tools\net472\Microsoft.DotNet.Build.Tasks.Installers.dll</MicrosoftDotNetBuildTasksInstallersTaskAssembly>
</PropertyGroup>
<UsingTask TaskName="CreateLightCommandPackageDrop" AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" />
<UsingTask TaskName="CreateLitCommandPackageDrop" AssemblyFile="$(MicrosoftDotNetBuildTasksInstallersTaskAssembly)" />
<Target Name="GenerateGUIDs" BeforeTargets="BeforeBuild" DependsOnTargets="_GeneratePackageGuids;_GenerateBundleGuids" Condition=" '$(DisableGuidGeneration)' != 'true' " />
<Target Name="_GeneratePackageGuids" Condition="'$(OutputType)' == 'package'">
<GenerateGuid Condition="'$(OutputName)' != '$(HostOptionsName)'" NamespaceGuid="$(NamespaceGuid)" Values="$(ProductNameShort);$(GuidInputs)">
<Output TaskParameter="Guid" PropertyName="ProductCode" />
</GenerateGuid>
<GenerateGuid Condition="'$(OutputName)' != '$(HostOptionsName)'" NamespaceGuid="$(NamespaceGuid)" Values="$(ProductNameShort);$(GuidInputs);$(OutputType)">
<Output TaskParameter="Guid" PropertyName="UpgradeCode" />
</GenerateGuid>
<GenerateGuid Condition="'$(OutputName)' == '$(HostOptionsName)'" NamespaceGuid="$(NamespaceGuid)" Values="$(ProductNameShort);$(Version)">
<Output TaskParameter="Guid" PropertyName="ProductCode" />
</GenerateGuid>
<GenerateGuid Condition="'$(OutputName)' == '$(HostOptionsName)'" NamespaceGuid="$(NamespaceGuid)" Values="$(ProductNameShort);$(AspNetCoreMajorMinorVersion);$(OutputType)">
<Output TaskParameter="Guid" PropertyName="UpgradeCode" />
</GenerateGuid>
<PropertyGroup>
<DefineConstants>$(DefineConstants);ProductCode=$(ProductCode);UpgradeCode=$(UpgradeCode)</DefineConstants>
</PropertyGroup>
</Target>
<Target Name="_GenerateBundleGuids" Condition="'$(OutputType)' == 'bundle'">
<!-- Don't need to use the name of the bundle since we have separate namespace GUIDs. The name will also changes based on the milestone and destabalize
the upgrade code. Bundle upgrades pivot on Major.Minor.Patch changes. For example, 3.0.1-preview 1 can upgrade to 3.0.1-preview 8, but 3.0.1
cannot upgrade to 3.0.2 or 3.1. -->
<PropertyGroup>
<BundleGuidInputs>$(AspNetCoreMajorMinorVersion);$(Platform)</BundleGuidInputs>
</PropertyGroup>
<GenerateGuid NamespaceGuid="$(NamespaceGuid)" Values="$(BundleGuidInputs)">
<Output TaskParameter="Guid" PropertyName="BundleProviderKey" />
</GenerateGuid>
<GenerateGuid NamespaceGuid="$(NamespaceGuid)" Values="$(BundleGuidInputs)">
<Output TaskParameter="Guid" PropertyName="BundleUpgradeCode" />
</GenerateGuid>
<PropertyGroup>
<DefineConstants>$(DefineConstants);BundleVersion=$(BundleVersion);BundleProviderKey=$(BundleProviderKey);BundleUpgradeCode=$(BundleUpgradeCode)</DefineConstants>
</PropertyGroup>
</Target>
<Target Name="_CheckPackageFileNameIsSet" BeforeTargets="PrepareForBuild">
<Error Text="Missing required property: PackageFileName" Condition="'$(PackageFileName)' == ''" />
</Target>
<Target Name="CopyToArtifactsDirectory"
Condition=" '$(IsShipping)' == 'true' AND '$(SkipCopyToArtifactsDirectory)' != 'true' "
BeforeTargets="Build">
<Copy SourceFiles="$(TargetPath)" DestinationFiles="$(InstallersOutputPath)$(PackageFileName)" />
<ItemGroup>
<_cabs Include="$(TargetDir)**/*.cab" />
</ItemGroup>
<Copy SourceFiles="@(_cabs)" DestinationFolder="$(InstallersOutputPath)" />
</Target>
<Target Name="CreateWixPackageDrop" AfterTargets="CopyToArtifactsDirectory">
<MakeDir Directories="$(WixCommandPackagesDir)" />
<ItemGroup>
<WixInstallerFilesToProcess Include="$(TargetPath)" />
<WixInstallerFilesToProcess Include="$(InstallersOutputPath)$(PackageFileName)"
Condition=" '$(IsShipping)' == 'true' AND '$(SkipCopyToArtifactsDirectory)' != 'true' " />
</ItemGroup>
<CreateLightCommandPackageDrop
LightCommandWorkingDir="$(WixCommandObjDir)"
OutputFolder="$(WixCommandPackagesDir)"
NoLogo="true"
Cultures="en-us"
InstallerFile="%(WixInstallerFilesToProcess.Identity)"
AdditionalBasePaths="$(MSBuildProjectDirectory)"
WixExtensions="@(WixExtension)"
Loc="@(EmbeddedResource)"
Sice="$(SuppressIces)"
WixProjectFile="$(MSBuildProjectFile)"
Fv="true"
WixSrcFiles="@(CompileObjOutput);@(WixObject);@(WixLibProjects);@(_ResolvedWixLibraryPaths)">
<Output TaskParameter="OutputFile" PropertyName="_LightCommandPackageNameOutput" />
</CreateLightCommandPackageDrop>
</Target>
</Project>