Click here to Skip to main content
11,409,450 members (60,760 online)
Click here to Skip to main content

Automate the Manifest Injection Process

, 22 Feb 2005
Rate this:
Please Sign up or sign in to vote.
Automate manifest injection using post-build events.

Sample Image - ManifestInjection2.jpg


In a previous article, I explored the ability to add a manifest as a resource to a compiled executable. This process allowed for XP themes to display correctly without the burden of yet another file to manage when distributing an application. The down side to my first article is that the process of injecting the manifest is cumbersome and is required each time the source code is compiled.

This article aims at streamlining the process of injecting the manifest in a “hands-off” manner by automatically injecting the manifest on the completion of each new build. The solution uses the Post-build property of a project to call a console version of the manifest injector, so no extra work is required when building the project.

Project Setup

To set up a project, first download the source for this article. Make note of the path to the ManifestConsole.exe. Now open a Windows Forms project and open up the project properties dialog. Select the Build Events option on the left. Click in the box for the Post-build Event Command Line. Click on the ellipsis button to open up the Post-build editor.

Post-build Command Line

The editor is where we’ll specify the path and arguments to call the ManifestConsole.exe. The ManifestConsole.exe requires two command line arguments. The first argument is the path to the target executable (i.e., which EXE to inject the manifest into). The second argument is the path to the manifest (for this example, it’s your project’s root directory).

An example of the command is as follows:

C:\ManifestInjection\ManifestConsole\bin\Release\ManifestConsole.exe $(TargetPath) $(ProjectDir)WindowsApplication1.exe.manifest

Post-build Editor

Ready to Build

If we dissect this command line, we’ll see three things. First is the path to the ManifestConsole.exe file. For now, this is the same location you put the source for this article. Change the C:\<path> accordingly. The first command line argument, $(TargetPath), will be filled in by Visual Studio with the EXE you are building. The last argument, $(ProjectDir)WindowsApplication1.exe.manifest, points to your project directory to a file named WindowsApplication1.exe.manifest. Change this argument to point to your manifest and you’re ready to build your project. *Note:* click the Macros button on the editor window for a list of paths Visual Studio .NET supports. Check the Output window for status on the injection process when you build your project. Now… run your app! Don’t you just love automation?


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer PageLabs
United States United States
I'm the founder of PageLabs, a web-based performance and SEO optimization site.

Give your site a boost in performance, even take a free speed test!
Follow on   Twitter

Comments and Discussions

GeneralTab controls not changing PinmemberRussell Gantman10-Oct-07 5:24 
GeneralRe: Tab controls not changing PinmemberAcoustic10-Oct-07 5:55 
GeneralRe: Tab controls not changing PinmemberRussell Gantman10-Oct-07 6:03 
I did that and there were no (property) differences, so therefore the differences had to be in code.
When I compared my code to the "standard" I realized what was going on...

I added a delegate to make my TabControl to perform an OwnerDraw (to allow me to make the header text bold).
this.tabControl1.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
this.tabControl1.DrawItem += new DrawItemEventHandler(this.tabControl1_DrawItem);

When I removed the above lines, all worked.

Thanks for your help...It pointed me in the correct direction.
Now all I need to do is figure out how to make the tab name bold for the selected tab.

I skate to where the puck is going to be, not where it is.
Wayne Gretzky

Questioncan't get it to work PinmemberSix CodeMaster5-Jun-06 10:11 
AnswerRe: can't get it to work PinmemberSix CodeMaster7-Jun-06 9:17 
QuestionWDM DLL question Pinmembertfryar10-Jan-06 9:05 
AnswerRe: WDM DLL question PinmemberAcoustic10-Jun-06 17:45 
Generalbeware of spaces Pinmemberdosdemon12-Sep-05 1:28 
GeneralRe: beware of spaces PinmemberMikael Levén18-Nov-05 9:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.5 | Last Updated 22 Feb 2005
Article Copyright 2005 by TylerBrinks
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid