Embed Manifest into EXE

This page is under construction. Consider this page unfinished/outdated/incorrect/etc. I’m just posting this here in case the little info I know may be able to help someone else.

Windows XP introduced Manifest files. If you have “Program.exe”, it may have a file called “Program.exe.manifest” with it.

If you have a program that was made before XP, the Manifest file can tell Windows how to do XP-specific things like adding theme support to how it looks.

In Windows Vista, the role of Manifest files has expanded. The Manifest may now include security information, such as specifying what access rights the program may need to run.

I’ve made some programs with Visual Basic 2005, and wanted them to require Admin access under Vista, so I made a manifest file for my program. I didn’t want to have to distribute more than just the EXE file though.

There are ways of embedding the Manifest file directly into the program.

This page has a program called “ThemeMe”:
http://www.msjogren.net/dotnet/eng/tools/default.asp

The official Microsoft program is called “mt.exe”.
It is part of the “Windows Software Development Kit for Windows and .NET Framework” package here:

http://www.microsoft.com/downloads/details.aspx?FamilyId=C2B1E300-F358-4523-B479-F53D234CDCCF

The Setup.exe file from there is just 400K, and it lets you download either the full SDK or just the parts you want.

For the minimum possible install to still get the MT.EXE file, select just this option: Win32 Development Tools


For my XdN Tweaker program, the Manifest file looks like this:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
   name="XdN.Tweaker"
   version="1.0.0.0"
   type="win32"/>
<description>Tweaking program for Windows</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
   <security>
      <requestedPrivileges>
         <requestedExecutionLevel
            level="requireAdministrator"
            uiAccess="False"/>
      </requestedPrivileges>
   </security>
</trustInfo>
</assembly>

To embed the Manifest into XdN Tweaker, I run this:

mt.exe  -manifest "XdN_Tweaker.exe.manifest" -outputresource:"XdN Tweaker.exe";1

Of course, newer versions of Visual Studio support manifest files natively, so things like this shouldn’t be needed any more.