Completely lost with installing core runtime (dotnet 8) #1639
-
Have the main installer sorted - does my desktop app and service Want to have it optionally install the dotnet 8 desktop & asp.net runtime and for the life of me can't figure out where to start, I know it involves something to do with "bootstrapping" but all the docs/examples I find online are old, incomplete and seem to assume a lot of prior knowledge or are so massively complicated, installing exercising every feature that I can't decipher what is happening. Can anyone point me to a simple working sample of say installing a dotnet 7 or 8 runtime before the main installer? This simple command line does all that I want: winget install --silent --accept-source-agreements --accept-package-agreements dotnet-desktop-8 aspnetcore-8 But I can't invoke it from the installer as that would nest the msiexec process. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 19 replies
-
I'm also installing .NET 8 on my side. I'm using a bootstrapper indeed. To do so, I'm creating an const string DotnetRuntimeDownloadUrl = "https://download.visualstudio.microsoft.com/download/pr/b280d97f-25a9-4ab7-8a12-8291aa3af117/a37ed0e68f51fcd973e9f6cb4f40b1a7/windowsdesktop-runtime-8.0.0-win-x64.exe";
(var hash, var size) = await GetHashAndSizeAsync(DotnetRuntimeDownloadUrl);
var dotnetInstaller = new ExePackage
{
Id = "DotNet8",
InstallArguments = "/install /quiet /norestart",
RepairArguments = "/silent /repair /norestart",
UninstallArguments = "/silent /uninstall /norestart",
PerMachine = true,
DetectCondition = "DOTNET_RUNTIME_CHECK >= v8",
Payloads = new Payload[] {
new ExePackagePayload
{
Name = "windowsdesktop-runtime-8.0.0-win-x64.exe",
DownloadUrl = DotnetRuntimeDownloadUrl,
Hash = hash,
Size = (int)size.Bytes
}
}
};
// specifying dotnetInstaller then yourMsiHere will make sure to install these in this exact order.
var bundle = new Bundle("BundleName", dotnetInstaller, yourMsiHere);
// Rest of your WixSharp setup The DetectCondition (DOTNET_RUNTIME_CHECK >= v8) results of this: // Adds .NET compatibility check to the bundle.
bundle.AddXml("Wix", new DotNetCompatibilityCheck(
"WindowsDesktopRuntimeCheck",
"DOTNET_RUNTIME_CHECK",
DotNetCompatibilityCheck.RollForwardPolicy.LatestMinor,
DotNetCompatibilityCheck.RuntimeType.Desktop,
Platform.x64,
new Version(8, 0, 0, 0)).ToXmlFragment()); |
Beta Was this translation helpful? Give feedback.
-
Fantastic stuff, carving out some time this weekend to test it. Related question - when installing dotnet runtimes as dependences of our apps, should we really be uninstalling them as part of our apps uninstaller? |
Beta Was this translation helpful? Give feedback.
I'm also installing .NET 8 on my side. I'm using a bootstrapper indeed.
To do so, I'm creating an
ExePackage
and specifying the URL where the user machine will be able to download the installer. You have also have to supply the installer's hash and its size to make sure that the machine has the one you intended to install.