0

I'm using WiX Toolset 5 and I need to detect the version of .NET installed on a machine. I have code to pull the value out of the registry:

SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost

but there's a problem with that registry value. If you've ever had a version of .NET installed, and uninstalled it, it stays the same. For instance, if you've installed .NET 6.0.18 and then .NET 8.0.7 and uninstall .NET 8, the registry value will still be 8.0.7.

Is there a better way to get the currently installed highest version of .NET either through a different registry key, a system command, or WiX?

2 Answers 2

1

Detecting .NET is way more complicated than it should be. Check out the DotNetCompatibilityCheck element . It will tell if the version of .NET you need is available.

Sign up to request clarification or add additional context in comments.

Comments

0

For .NET Framework there is only the registry key. (Powershell can read from the registry easily, so not to hard to script.)

For .NET

dotnet --list-sdks

But note, you need to adjust the versions based on the current project's global.json. Eg. you could have various versions up to and including 9.0.100-preview.7.24407.12 installed, but the global.json says 6.0.300, and that should be respected.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.