Microsoft KB Archive/944276

= How to embed a manifest file in an executable file in Visual Studio 2005 =

Article ID: 944276

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 2.0

-



SUMMARY
This step-by-step article describes how to embed a manifest file in an executable (.exe) file in Microsoft Visual Studio 2005. If you want to develop a &quot;Certified for Windows Vista&quot; program, you have to embed a manifest file in an executable file.



MORE INFORMATION
In this article, the placeholder  refers to a sample application. You should replace the  placeholder with the real name of the application.

To embed a manifest file in an executable file, follow these steps:  In Visual Studio 2005, open the application. On the Build menu, click Configuration Manager. In the Configuration Manager window, determine whether the x86 item already exists in the Active solution platform list.  If the x86 item does not exist, go to step 4. If the x86 item already exists, select  in the Active solution platform list. In the Edit Solution Platforms dialog box, click x86, click Remove, and then click Close.  In the Configuration Manager window, select <New…> in the Active solution platform list.</li> In the New Solution Platform dialog box, type x86 in the Type or select the new platform box, select <Empty> in the Copy settings from list, click to clear the Create new project platforms check box, and then click OK.</li> In the Configuration Manager window, click Close.

Note If you are using a post-build script to call the MT.exe file, remove the post-build script. In this case, you do not have to call the MT.exe file to embed the manifest file.</li> On the Build menu, click Rebuild Solution.</li> On the File menu, click Close Solution.</li>  Start Notepad, and then paste the following code in the new document: <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?> <assembly xmlns=&quot;urn:schemas-microsoft-com:asm.v1&quot; manifestVersion=&quot;1.0&quot;> <trustInfo xmlns=&quot;urn:schemas-microsoft-com:asm.v3&quot;> <requestedPrivileges> <requestedExecutionLevel level=&quot;asInvoker&quot; uiAccess=&quot;false&quot;/> </requestedPrivileges> </trustInfo> </li> On the File menu, click Save As, and then save this file as .exe.manifest.</li> On the File menu, click Close.</li> In Visual Studio 2005, open the  file. A tree view is displayed.</li> Click the   node, and then click Add Resource.</li> In the Add Resource dialog box, click Import, locate the .exe.manifest file, and then click Open.</li> In the Custom Resource Type dialog box, type RT_MANIFEST, and then click OK.</li> In the Properties panel, change the value of the ID property from &quot;101&quot; to &quot;1&quot;.

Note If you want to verify that the XML in the manifest is correct, double-click the manifest in the tree view to see the binary. The ASCII data appears.</li> On the File menu, click Save All.</li></ol>

If the  file is a part of a ClickOnce deployment application, you must update the ClickOnce application manifest file and the deployment manifest file. You must do this because the hash of the executable file is changed when you embed a manifest file in an executable file. To update the ClickOnce application manifest file and the deployment manifest file, use the Manifest Generation and Editing Tool. You can use either the command-line version (Mage.exe) or the Windows Forms version (MageUI.exe).

If you use Mage.exe, open a command prompt, access the directory where Mage.exe is stored, and then run the following two commands:

mage.exe -u \  -Name &quot; &quot; -Version   -FromDirectory   -cf  \  -pwd &quot; &quot;

mage.exe -u \  -appm  \  -cf  \  -pwd &quot; &quot;

Keywords: kbhowto kbexpertiseadvanced KB944276

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.