locked
Embedding manifest in post-build event exited with code 9009 in VS2008 RRS feed

  • Question

  • I tried to put the following command line in post-build event in VS2008 for a C# application to automate the embedding of manifest file according to the msdn article: http://msdn.microsoft.com/en-us/library/bb756929.aspx, which was written for VS2005:

    mt.exe -manifest "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;#1"

    A build error occurred:
    The command line "mt.exe -manifest "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;#1"" exited with code 9009.

    I could not find anything helpful on internet.

    Thanks!

    Tuesday, October 20, 2009 9:37 PM

Answers

  • Hello,


    It looks like the mt.exe is not found. First, make sure you install the Windows SDK which consists of the mt.exe tool

    Two solutions,
    1. Try to use the  whole path of the mt.exe

    "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe -manifest"  "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;#1"


    2.Alternatively, you can add the mt.exe path to System environment and restart Visual Studio so that VS can find the mt.exe

    See some similar problems here,
    http://social.msdn.microsoft.com/forums/en-US/windowsgeneraldevelopmentissues/thread/42f3fa84-87a6-4eed-aeb9-143316af2013/
    http://www.dotnetmonster.com/Uwe/Forum.aspx/vs/5901/MT-EXE-and-Error-9009

    Let us know if this resolves the issue for you!

    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, October 21, 2009 5:20 AM
    Moderator
  • After adding the path of mt.exe to environment variable PATH, I got a different error of "The specified resource type cannot be found in the image file".  However, using -outputresource instead of -updateresource resolved the error and the build was successful.

    Thanks for the help!

    Monday, October 26, 2009 8:40 PM
  • I had the same problem today. My application cleans development folders (bin etc) and I wanted to delete folders with files. Xp was not a problem but after I upgraded to Windows 7 it didn't work as suposed anymore (UAC rights).
    Spent to whole morning googling for a solution and concluded mt.exe was missing while SDK etc. was installed.

    As always the solution is more simple then I thought.
    Just added a app.manifest file to my project. Chose the right setting (already as comment in the file), building and voila ....

    Hopes this works for you too.

    Arjan
    • Proposed as answer by ArjanBecker Sunday, November 29, 2009 11:14 AM
    • Marked as answer by Ji.ZhouModerator Thursday, September 9, 2010 2:49 AM
    Sunday, November 29, 2009 11:14 AM

All replies

  • VS2008 supports manifest files as part of the build process.  The VS2005 documentation is not needed.  Add the manifest file to your project (either by adding the existing file or using Add New Item -> Application Manifest).  If necessary open the project's property page and specify the manifest under the General tab.  The application manifest is called app.manifest but I don't know if the name actually matters provided you set up the project correctly.  After that the build process will handle everything else.

    Michael Taylor - 10/20/09
    http://p3net.mvps.org
    Wednesday, October 21, 2009 3:48 AM
    Moderator
  • Hello,


    It looks like the mt.exe is not found. First, make sure you install the Windows SDK which consists of the mt.exe tool

    Two solutions,
    1. Try to use the  whole path of the mt.exe

    "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe -manifest"  "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;#1"


    2.Alternatively, you can add the mt.exe path to System environment and restart Visual Studio so that VS can find the mt.exe

    See some similar problems here,
    http://social.msdn.microsoft.com/forums/en-US/windowsgeneraldevelopmentissues/thread/42f3fa84-87a6-4eed-aeb9-143316af2013/
    http://www.dotnetmonster.com/Uwe/Forum.aspx/vs/5901/MT-EXE-and-Error-9009

    Let us know if this resolves the issue for you!

    Ji Zhou

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, October 21, 2009 5:20 AM
    Moderator
  • After adding the path of mt.exe to environment variable PATH, I got a different error of "The specified resource type cannot be found in the image file".  However, using -outputresource instead of -updateresource resolved the error and the build was successful.

    Thanks for the help!

    Monday, October 26, 2009 8:40 PM
  • I had the same problem today. My application cleans development folders (bin etc) and I wanted to delete folders with files. Xp was not a problem but after I upgraded to Windows 7 it didn't work as suposed anymore (UAC rights).
    Spent to whole morning googling for a solution and concluded mt.exe was missing while SDK etc. was installed.

    As always the solution is more simple then I thought.
    Just added a app.manifest file to my project. Chose the right setting (already as comment in the file), building and voila ....

    Hopes this works for you too.

    Arjan
    • Proposed as answer by ArjanBecker Sunday, November 29, 2009 11:14 AM
    • Marked as answer by Ji.ZhouModerator Thursday, September 9, 2010 2:49 AM
    Sunday, November 29, 2009 11:14 AM