tags:

views:

714

answers:

3

Hi,

I am curious whether I need two manifest files that are created when I publish my application. It works when I delete them. In the case they are needed, I have tried to embed (Project>Application>Embed manifest with default setting) them but they are still external.

Those are: (appname).exe.manifest and (appname).application.

Thanks for advice!

A: 

It is needed for the purpose of

specifying the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes

Ngu Soon Hui
+2  A: 

The manifest file describes how your application should run. From MSDN:

Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information.

So deleting them is probably the wrong thing to do, especially if you want your application to run elevated by default on Vista and beyond.

Here are details from MSDN on use of the mt tool, which is used to embed the manifest in your application.

Also note a really interesting issue concerning the caching of the manifest in Vista and beyond that looks like a real gotcha.

Jeremy McGee
A: 

Also, Back when VS2003 was used, and you want to make your controls look more like the XP interface, the manifest will contain the common controls with the appropriate version 6.x which is used along with your application, then the GUI gets a "nice updated look and feel of XP" instead of the old clunky windows 2000 controls. For that reason, you can have the manifest embedded as a resource so you do not have to lug around a manifest file (ok, it is a quite small file) but nonetheless, it makes the application distribution neater.

And also, there was a bug in the .NET 1.1 runtime (now fixed in 2.0+) where if a manifest is used at your application fails to update the GUI to give it more of an XP look and feel. The workaround at the time was to call Application.DoEvents before doing an Application.Run(new form());

Now, with Vista and Win 7, the manifest is used to specify elevated permissions to get around the UAC thereby minimizing the chance of Vista/Win 7 having to pop up an UAC dialog box.

Hope this helps, Best regards, Tom.

tommieb75
BTW, how to embedd them?
Petr
It doesn't minimise the chance of a UAC dialog appearing - it forces it to always appear if you specify that your application NEEDS administrator privileges (which most don't, so please don't do this).
Zooba
I would like to distribute only one EXEcutable file (and the setting file)...so how manifest can be embedded? The option in Application doesnt do that.
Petr
From your solution explorer in VS, you need to add the manifest file into it, right click on your project, click Add, then click on Application Manifest File, it will be called app.manifest. Right click on that file and select properties, look for Build options, click on the drop down and select Embedded Resource. Hope this helps, Tom :)
tommieb75
Tom, thank you, but those files are still present when publish :( I am using it with Application>Embed manifest.
Petr