views:

67

answers:

1

I have a windows forms app that is modifying some registry keys under the software section. Vista non admins are complaining that they are getting a permission error. I did what it said in this post:

http://stackoverflow.com/questions/562350/requested-registry-access-is-not-allowed

Created an app.manifest file and pasted what was said in there. Do I need to align these values to my app:

<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />

Also, when I compile in release mode, I am only seeing a *.vshost.manifest, but not a *.manifest file. I tried renaming the vshost one but it still won't work if I'm not an admin.

I guess what I'm asking here is how do I deploy this manifest file? I searched google for it but can't find any good info.

+2  A: 

The important part in the other post you are referring to is this:

 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
     <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
     </requestedPrivileges>
  </security>

By setting the requestedExecutionLevel to "requireAdministrator", your application will request administration rights on start. This will also cause the application icon to display the UAC shield icon overlay (telling the user that this executable requires administrator rights). The reason why you see no manifest file in your output directory, is probably because the default setting is to embed the manifest in the executable. You can change this setting to create and use an external manifest.

For manifest options in Visual Studio, check the project properties, then select Configuration Properties -> Manifest Tool -> Input and Output. There you can specify additional manifest files that will be included in your manifest, and also specify if you want to embed the manifest or not.

Hope this helps.

humbagumba
I go to properties of the project. Under application I see "resources" and there is a text box for "manifest" and there it says "app.manifest". With these settings I built and it only gave me the .vshost. I didn't see a tab called "configuration properties" though
Ready Cent
What version of Visual Studio are you using? My instructions are based on VS 2005.
humbagumba