0

I have a Visual Studio setup project together with a C# bootstrapper. The app usually was installed system-wide and requires admin permissions to be started. The new version uninstalls the old version and installs the new version in a per-user environment.

For the first installation of the new software version, admin privileges are required, but for starting the software and updates, no admin permissions are needed. In case of an update, I want to get the version of the software installed by that user and compare it to the update version.

The problem is, that the version info is not written into normal user registry place:

HKEY_CURRENT_USER\Software\<SoftwareVendor>\<SoftwareName>

Instead it is written to

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{<..Product-Code...>}. 

Every user writes to that HKLM location, so I don't know which version was installed by the specific user. Why is this version info written to this place? Is there a way to change this?

The Visual Studio setup project registry (project -> view -> registry) is set to HKEY_CURRENT_USER -> Software -> Manufacturer. Is this correct?

I know that I could use a file to save the version info, I was just wondering why the usual registry way is not working.

[Edit 1]: I'm setting the version number inside of the Visual studio setup project properties.

1 Answer 1

1

This isn't the way to do this. The registry isn't reliable.

Every project that you compile has embedded version information in the format 111.222.333.444. You can change the version number manually, or have it changed in your build pipeline. Since the version number is embedded in the file, there's no need to put it anywhere else on the machine.

See here: How can I get the assembly file version

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

2 Comments

I want to get the version set with the msi that is shown in "add or remove programs". Unfortunately this version is not identical to the (historical) internal FileVersion saved with the .exe file.
You need to change the MSI package to read the internal file version. Everything is supposed to use the internal file version as the canonical version. This is how Windows has worked for at least 20 years, for consistency. If this isn't what you're doing, you're doing it wrong.

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.