Thursday, February 22, 2007 5:23 PMOk, I nearly went crazy with this one:
I am developing on Vista, with VS 2005. The user I am logged in as is NOT part of the admin group, and I am NOT running with admin priviliges. UAC has NOT been disabled on this machine. The Vista patch for VS2005 has been installed. The application is created on a drive that's mapped with the SUBST command.
I created a sample ConsoleApplication1 using the Visual Studio 2005 Wizard, .NET Console project. Hit Ctrl-F5. Project runs fine, get a nice black console window, with the words "Hit any key to continue".
Then I created the same blank project, but named it "UpdateFoo", or "FooSetup". Hit Ctrl-F5 to run it. On the substituted drive, I get a "[insert path]\FooSetup.exe The specified path does not exist. Check the path, and then try again. Checking the path, the file is there. Double click, and you get the same message.
Create the project "FooSetup" on a normal drive. Compile and run and you get the UAC nanny "An unidentified program wants to run on your computer" - the dialog states that the publisher is unknown. Its true, the app is neither code-signed [irrelevant] nor is it gone through the SignCode Wizard and signed with a valid SPC certificate from Verisign.
Now copy the ConsoleApplication1.exe that was generated to the desktop. Double click - you will get a quick DOS box flash, indicating the program ran. Hit F2 and rename the program to SetupFoo.exe. Notice the icon changes immediately adding the Red, green, blue and yellow shield from UAC. Double clicking will get the you UAC prompt.
Now close VisualStudio, and rerun it as administrator. Load FooSetup, and run it. It runs without the UAC nanny. [This is the dangerous part, if you develop as administrator, you will never see this problem on your box.!]
Where does this leave us? My take away lesson is: don't create projects under VisualStudio that have the words Setup and Update in them. They may not run without codesigning. Troubling is also that I don't know what other "keywords" will trigger the UAC. It seems that UAC is a function of both the name, and the name of the Visual Studio project! When running on substitued drivers, weird error messages happen. Also, if you're an unpriviliged user under Vista, try renaming setup.exe to foo.exe and running it. If the installer does not need priviliges (unlikely), you may get away with installing the program.
There you have it folks - these issues point to a poorly thought out implementation of UAC, something will have to be changed to address these issues. Keying off a specific name is a really really bad idea.
Friday, February 23, 2007 9:04 PMOK, found out how it works here: http://www.microsoft.com/downloads/details.aspx?FamilyID=BA73B169-A648-49AF-BC5E-A2EEBB74C16B&displaylang=en
Saturday, April 28, 2007 8:48 PM
You can add a manifest to your application like so:Code Snippet
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="22.214.171.124" name="MyApplication.app"/>
asInvoker makes sure that Windows does not prompt for elevation!