2

I'm making a DLL in C# that I would like to be visible in COM without registration. Following instructions elsewhere I have generated a new "app.manifest" file in the project and edited it to include the COM information I need rather than the generic UAC information.

Except Visual Studio won't let me use it instead of the default manifest. When I open the project's properties, the manifest dropdown is disabled: Note that the manifest dropdown is disabled.

What do I need to do to select & embed the custom manifest I've added to the project?

Edit: The "app.manifest" file is in the project's Properties folder. As described here, for registration-free COM I need to change the Manifest from embedding a default manifest to using the manifest in Properties. Except it won't let me change that setting for some reason.

Edit 2: The Manifest dropdown is enabled when I change the output type to Console Application or to Windows Application. Why would it be disabled for a class library when MSDN explicitly states that a manifest is needed for registration-free COM libraries?

Oblivious Sage
  • 3,326
  • 6
  • 37
  • 58
  • possible duplicate http://stackoverflow.com/questions/4084585/how-to-embed-a-manifest-file-at-compile-time-in-visual-studio-2010 – DLeh Jan 15 '15 at 20:54
  • @DLeh The answer there covers creating the manifest, which I've already done. My problem is that it's not letting me *embed* the manifest. – Oblivious Sage Jan 15 '15 at 20:57
  • [You are doing it wrong](http://stackoverflow.com/a/27946718/17034). – Hans Passant Jan 15 '15 at 22:58

1 Answers1

1

Class libraries don't need to use that dropdown to embed a manifest.

Important Note: Pretty much the only reason you would embed a manifest into a C# library this way is to make it available for use via registration-free COM. If you're not doing that, you don't need a manifest and these steps are not for you. Go away.

If you use Add -> New Item -> Application Manifest File to add an app.manifest file to the project:

scroll down in the New File list to find Application Manifest File

...and keep it in the project root (not in Properties, or any other subfolder):

app.manifest must not be nested

...it will automatically be embedded into the DLL.

You can verify that it was automatically added by using File -> Open -> File to open the DLL once it's built and confirming that it includes something called RT_MANIFEST:

notice the DLL contains an RT_MANIFEST entry

Special thanks to Hans Passant for providing all this information, albeit spread around half a dozen answers to different questions rather than all in one place.

Oblivious Sage
  • 3,326
  • 6
  • 37
  • 58