Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing .NET Runtime via WIX 4 Installer

Tags:

.net

wix

wix4

I am using WIX 4 via the HeatWave Visual Studio extension to create an installer for my .NET 7 application. I would like the installer to automatically install .NET 7 runtime during the installation process, if it is not already installed on the machine.

I have used the information in this post: https://wixtoolset.org/docs/tools/wixext/dotnet/ to display an error message if the runtime is not installed, but ideally I would like my installer to install it.

like image 438
Codisattva Avatar asked Oct 28 '25 00:10

Codisattva


1 Answers

This is pretty much a pain these days. You might want to consider just publishing you app with a private self-contained .net runtime. The reason is the WiX community just can't keep up with the .NET team as the team is releasing about something like 15 installers every release and they are doing it once or twice a month.

I started this repos to collect these if anyone wants to contribute. One sample I have is Desktop Runtime 7.0.11 x64. Created just two months ago, it's already two versions out of date.

https://github.com/iswix-llc/IsWiX.NetCore/blob/main/Installer/IsWiX.NetCore/Net7/DesktopRuntime/DesktopRuntime-x64-7.0.11.wxs

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
    <Fragment>
        <netfx:DotNetCoreSearch RuntimeType="desktop" MajorVersion="7" Platform="x64" Variable="DOTNETDESKTOPVERSION"/>
        <PackageGroup Id="DotNetDesktop7011Redist">
            <ExePackage Id="DotNetDesktop7011"
                        DetectCondition="DOTNETDESKTOPVERSION &gt;= &quot;7.0.11&quot;"
                        Permanent="yes"
                        Vital="no"
                        InstallArguments="windowsdesktop-runtime-7.0.11-win-x64.exe /install /quiet /norestart"
                        RepairArguments="windowsdesktop-runtime-7.0.11-win-x64.exe /repair /quiet /norestart"
                        UninstallArguments="windowsdesktop-runtime-7.0.11-win-x64.exe /uninstall /quiet /norestart">
                <ExePackagePayload
                            Description="Microsoft Windows Desktop Runtime - 7.0.11 (x64)"
                            ProductName="Microsoft Windows Desktop Runtime - 7.0.11 (x64)"
                            Name="windowsdesktop-runtime-7.0.11-win-x64.exe"
                            DownloadUrl="https://download.visualstudio.microsoft.com/download/pr/2ce1cbbe-71d1-44e7-8e80-d9ae336b9b17/a2706bca3474eef8ef95e10a12ecc2a4/windowsdesktop-runtime-7.0.11-win-x64.exe"
                            Hash="c5f042dadd878e2cbd1833a73141e64fba2fae10ba5770daac8faf24bb56d7bc61cae8f7664c37fa822db71d0bf05b97733126db396e97e9ceeced596b9a63c1"
                            Size="57837864" 
                            Version="7.0.11.32825"
                            />
            </ExePackage>
        </PackageGroup>
    </Fragment>
</Wix>
like image 157
Christopher Painter Avatar answered Oct 29 '25 14:10

Christopher Painter