Skip to content
Merged
34 changes: 34 additions & 0 deletions src/Common/wix/dotnethome_x64.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?ifndef Platform ?>
<?define Platform = "$(sys.BUILDARCH)" ?>
<?endif ?>

<!-- The following match the expected values for PROCESSOR_ARCHITECTURE
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
<?if $(var.Platform)=x86?>
<?define InstallerArchitecture="X86"?>
<?elseif $(var.Platform)=x64?>
<?define InstallerArchitecture="AMD64"?>
<?elseif $(var.Platform)=ARM64?>
<?define InstallerArchitecture="ARM64"?>
<?endif?>

<Fragment>
<!-- Identify when installing in emulation as when PROCESSOR_ARCHITECTURE does not match the installer architecture
https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details -->
<SetProperty Action="Set_INSTALLING_IN_EMULATION" Id="INSTALLING_IN_EMULATION" Value="true" Before="CostFinalize">
NOT %PROCESSOR_ARCHITECTURE="$(var.InstallerArchitecture)"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we have wixtoolset/issues#6556 this goes away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to port this into release/6.0 as well I think since Arcade snapped and main now targets 7.0

FYI @pjcollins this will impact maui workload pack generation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to port this into release/6.0

Right, that's the plan here: #7785 (comment)

</SetProperty>
</Fragment>

<?if $(var.Platform)=x64?>
<Fragment>
<!-- When running in x64 emulation and user hasn't specified install directory, install to an x64 subdirectory-->
<SetProperty Action="Set_DOTNETHOME_x64" Id="DOTNETHOME" Value="[ProgramFiles64Folder]dotnet\x64\" After="Set_INSTALLING_IN_EMULATION">
INSTALLING_IN_EMULATION AND NOT DOTNETHOME
</SetProperty>
</Fragment>
<?endif?>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<None Include="build/**/*.*" Pack="true">
<PackagePath>build</PackagePath>
</None>
<None Include="..\Common\wix\dotnethome_x64.wxs" Link="build\wix\product\dotnethome_x64.wxs" PackagePath="%(Link)" Pack="true" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<?include "..\variables.wxi" ?>
Expand Down Expand Up @@ -51,6 +52,9 @@
<Directory Id="DOTNETHOME" Name="dotnet" />
</Directory>
</Directory>
</Fragment>

<?if $(var.Platform) = x64 ?>
<CustomActionRef Id="Set_DOTNETHOME_x64" />
<?endif?>
</Fragment>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<WixExtensions Include="WixUtilExtension.dll" />

<WixSrcFile Include="$(MSBuildThisFileDirectory)product/product.wxs" />
<WixSrcFile Include="$(MSBuildThisFileDirectory)product/dotnethome_x64.wxs" />
<WixSrcFile Include="$(MSBuildThisFileDirectory)product/provider.wxs" />
</ItemGroup>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public override bool Execute()
List<string> sourceFiles = new();
string msiSourcePath = Path.Combine(MsiDirectory, $"{nupkg.Id}", $"{nupkg.Version}", platform);
sourceFiles.Add(EmbeddedTemplates.Extract("DependencyProvider.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("dotnethome_x64.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("ManifestProduct.wxs", msiSourcePath));

string EulaRtfPath = Path.Combine(msiSourcePath, "eula.rtf");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ protected IEnumerable<ITaskItem> Generate(string sourcePackage, string swixPacka
string msiSourcePath = Path.Combine(MsiDirectory, $"{nupkg.Id}", $"{nupkg.Version}", platform);
sourceFiles.Add(EmbeddedTemplates.Extract("DependencyProvider.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("Directories.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("dotnethome_x64.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("Product.wxs", msiSourcePath));
sourceFiles.Add(EmbeddedTemplates.Extract("Registry.wxs", msiSourcePath));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<EmbeddedResource Include="Misc\*.*" />
<EmbeddedResource Include="MsiTemplate\*.wxs" />
<EmbeddedResource Include="MsiTemplate\*.wxi" />
<EmbeddedResource Include="..\..\Common\wix\dotnethome_x64.wxs" Link="MsiTemplate\dotnethome_x64.wxs" />
<EmbeddedResource Include="SwixTemplate\*.swr" />
<EmbeddedResource Include="SwixTemplate\*.swixproj" />
<EmbeddedResource Include="SwixTemplate\*.vsmanproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@
</Directory>
</Directory>
</Directory>

<?if $(var.Platform) = x64 ?>
<CustomActionRef Id="Set_DOTNETHOME_x64" />
<?endif?>
</Fragment>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
</Directory>
</Directory>

<?if $(var.Platform) = x64 ?>
<CustomActionRef Id="Set_DOTNETHOME_x64" />
<?endif?>

<MediaTemplate CompressionLevel="high" EmbedCab="yes" />

<!-- Record the original package used to generate the MSI -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Feature Id="F_RegistryKeys" Absent="disallow" AllowAdvertise="no" Description="Registry keys."
Display="hidden" InstallDefault="local" Level="1" Title="Workload Pack Registration" TypicalDefault="install">
<Component Id="C_InstalledPack" Win64="$(var.Win64)" Directory="TARGETDIR">
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\dotnet\InstalledPacks\$(var.PackageId)\$(var.PackageVersion)">
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\dotnet\InstalledPacks\$(var.Platform)\$(var.PackageId)\$(var.PackageVersion)">
<RegistryValue Name="DependencyProviderKey" Type="string" Value="$(var.DependencyProviderKeyName)" KeyPath="yes"/>
<RegistryValue Name="ProductCode" Type="string" Value="$(var.ProductCode)"/>
<RegistryValue Name="UpgradeCode" Type="string" Value="$(var.UpgradeCode)"/>
Expand Down