Click here to Skip to main content
15,883,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created a desktop application using C#.
The installable (.msi) created is being installed on the client machine by the administrator using his login account. During the installation process, "Everyone" option is selected to make sure the exe is accessible to all the users. A shortcut is placed on the desktop for each user.
Then he deletes the installable file.
But when the actual user logins ( other than the Admin) and tries to launch the application by clicking on the shortcut, the application starts referencing the .MSI installable to run.

If the admin has not deleted the .msi installable when he does the installation, the user who logs in next time can run the application as it refers to the installable.

I want the installable to be run once for everyone, then deleted, and then any user who logs in should be able to launch the application.

This is for the first that i am creating installables for the project. Please guide me or any references should help.

Thank you in advance,
Sai

What I have tried:

New to this issue guide me how to overcome this issue
Posted
Updated 31-Jul-19 21:43pm
Comments
lmoelleb 30-Jul-19 8:08am    
This is unlikely to be related to your C# code. More likely it is the tool building the installer that is causing issues. So start by googling the problem - including the name of whatever you use to create the MSI. If you can't find a solution, then ask with details on how you build your MSI.

After opening an SRX with Microsoft support i finally have the real answer.

This is copied from forum:

"I did more research on the behavior and found that it can be reproduced even with a very simple setup project. I used Orca MSI editor to check the .msi file and found that in the Registry Table the Root column has value 1 which means the registry root key will be HKEY_CURRENT_USER . So I modified it to -1 which means the registry root key will depends on user’s choices: Per User or Per Machine installation. You can reference http://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx for more deails.

After I change the Root value from 1 to -1 if I run the .msi and install the app for all users then the registry key will be created under HKLM instead of HKCU. Thus when the second user logs on it can run the app normally.

I’m not sure why in VS 2008 a setup project has those registry keys created under HKCU but for now you can modify it in Orca MSI editor to make it work for you."
 
Share this answer
 
The installation procedure / script is faulty.

The shortcut being created is pointing to the "msi" and not the exe that is installed.

Right-click the shortcut to see properties / target folder. Figure out why its pointing to where it is.
 
Share this answer
 
The shortcut you're using to launch the app is "advertised". That means that, when launched, the .MSI is located and all "key paths" are checked, files and registry keys/values, to make sure nothing is missing. If they are, the .MSI is needed to get the data to recreate those files/values.

This happens for both machine-specific locations (like HKEY_LOCAL_MACHINE and C:\Program Files) and user-specific locations (like HKEY_CURRENT_USER and C:\Users\[userId]).

[EDIT]
I forgot to mention that this is also how features of an application are installed "on demand". For example, you can install some of the Office applications, like Word and Excel, and then the other applications can be just shortcuts that don't have anything installed for them, like Outlook, until you try to launch it from the shortcut. Only then will Outlook be installed.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900