vs2005 manifest files

Data Danger

Freshman
Joined
Mar 25, 2004
Messages
29
HI All

:confused: I have got myself quite confused about manifest files and how to use and insert them into my VB.NET application. I have read lots about them but some of the information on the web is quite old.

I want to do the right thing and send out a manifest file if thats what is required. I have tested my VB.NET programs on the Vista OS and without using a manifest file when I click on one of my programs that do require admin rights the UAC does appear as is should. My other program that does not require admin rights works with no prompt. Does this mean that a manifest file is been used somewhere in my application that I do not know about or has the code first been checked before loading and it has found that admin rights would be required?

Could somebody please also give me some links to using manifests in my VB.NET application that are simple to understand or even step by step instructions.

VS2005 SP1
VB.NET Programming
Windows XP SP2

Regards
-Paul
 
Surprised

I'm very surprised that with all the knowledge on this site that nobody can answer this but thank you to those that read it.

-Paul
 
http://msdn2.microsoft.com/en-us/security/aa480150.aspx gives a broad outline of what you need to do.

Taken from that link is a sample minfest
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="IsUserAdmin"
     type="win32"/> 

  <description>Description of your application</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>
this should get you started on generating your own manifest. As an example for an executable called WindowsApplication1.exe you would create a file called WindowsApplication1.exe.manifest that would contain
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
  <assemblyIdentity version="1.0.0.0"
     processorArchitecture="X86"
     name="WindowsApplication1"
     type="win32"/> 

  <description>Description of your application</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="requireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

After building your application if the .exe and the .exe.manifest are in the same folder run the following command
Code:
mt -nologo -manifest windowsApplication1.exe.manifest -outputresource:WindowsApplication1.exe;1
If you are building a dll rather than an exe replace the 1 at the end with a 2. Try running the app and you should get the prompt to elevate to admin, also in explorer you should see the icon overlay as well.
 
Last edited:
Back
Top