26

I've read here and here for ways to embed my application's manifest files inside the PE but these steps do not seem to work for VC#:VS2008 - VS2008 doesn't even come with mt.exe (as far as i know)

How might I go about doing this?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Dacto
  • 2,901
  • 9
  • 45
  • 54

1 Answers1

58

You can add a manifest to your C# application by following these steps:

  1. Right-click on your project in the Solution Explorer
  2. Select "Add New Item" from the context menu.
  3. Choose "Application Manifest File" from the list of options in the dialog box that appears.

However, note that Visual Studio already adds a manifest to your project by default in order to ensure compliance with UAC found in Windows Vista and 7. If you want to specify that a custom manifest file should be used by your project instead, follow these additional steps:

  1. Once you've added your custom manifest file to your project, right-click on your project in the Solution Explorer and click "Properties" (or double-click on the "Properties" item under your project).
  2. Under the first tab ("Application"), you should see a group of options specifying how your application manages resources. You can leave the default "Icon and manifest" option selected, but you need to select your custom manifest file from the drop-down box labeled "Manifest".

Finally, for the sake of completeness or if the above steps don't work for you, you can still use mt.exe to embed your manifest file into your application's EXE after you've built it. If it wasn't included with your installation of Visual Studio, you'll need to download and install the Windows SDK. Get the latest version for Windows 7 and the .NET Framework 4.0 here.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • @Dacto: I suppose you could, but...why? I'm not sure what your question is. Did the first part of my answer not work for you? You shouldn't *need* to use mt.exe at all. – Cody Gray - on strike Dec 08 '10 at 09:25
  • 1
    well i dont need a custom manifest i just want to distribute one exe not the exe and the UAC-compliant manifest – Dacto Dec 08 '10 at 18:12
  • @Dacto: OK, I understand what you're asking now. But Visual Studio will automatically embed the manifest into your EXE as part of the build process. It works flawlessly for me in a new C# project. There is no separate manifest file created that has to be distributed with my application. Are you experiencing different results? The steps I outlined above allow you to specify a *custom* manifest that is embedded into your application's EXE. The default is to embed the default (UAC-compliant) manifest into the EXE. – Cody Gray - on strike Dec 09 '10 at 03:46
  • I can send you screenshots to show you exactly what i'm seeing – Dacto Dec 09 '10 at 08:51
  • @Dacto: If you'd like, you can edit your question here and add the screenshots. (That will also "bump" your post up so that others might notice and contribute an answer.) I definitely don't understand either what you're trying to do or why it's not working. – Cody Gray - on strike Dec 11 '10 at 08:19
  • "Application Manifest File" does not exist. – Caleb Fenton Apr 29 '23 at 02:26