Alain Hogue
Alain Hogue

Reputation: 1

Missing UAC shield overlay on desktop shortcut icon when created by msi created from VS 2008

I created a setup program to deploy my VBNet program using Visual Studio 2008. Inside this setup program I created a shortcut to the "primary output" to be installed on the user desktop.

Now, everything is working correctly. The program is installed under "C:\Program Files" and the shortcut is created on the desktop. Also, when I use this shortcut I am prompted by UAC to autorize running this program as administrator. So far, so good...

But! My desktop icon does not have the UAC shield overlay even if the program is compiled with the manifest stating that it must run as administrator. Also, if I manually create a new shortcut on the desktop to the same executable after the installation, this new shortcut WILL have the shield overlay!

I have tried to reboot and delete the iconCache.db file but it did not work.

So my question is: How can I have my desktop shortcut appear WITH the UAC shield overlay when installed initially.

Thanks!

Upvotes: 0

Views: 2087

Answers (3)

Lumo
Lumo

Reputation: 687

You can make your shortcuts non-advertised by changing one table row in the msi file either using Orca or automatically by visual studio using a post build event.

Go to the Project's Properties, and enter the following PostBuildEvent:

cscript //nologo "$(ProjectDir)WiRunSql.vbs" "$(BuiltOuputPath)" "INSERT INTO Property(Property, Value) VALUES ('DISABLEADVTSHORTCUTS', '1')"

The WiRunSql.vbs file is available from microsoft

Regards Lumo

Upvotes: 2

Alexey Ivanov
Alexey Ivanov

Reputation: 11848

I would suggest that the icon created by the installer does not point to the .exe file but rather to a registry key. Open shortcut properties, if Target field on Shortcut tab is disabled and contains the name of the application, then it is the case.

You can make your icon non-advertised, then the created shortcut would point to .exe file. However in this case, the installation can't be automatically repaired if .exe becomes missing.

Upvotes: 0

Anders
Anders

Reputation: 101666

Without any more details, my only guess is that you create the shortcut before the target exists so that windows is unable to see the manifest.

Upvotes: 0

Related Questions