When Building a release version of my C# application in Visual Studios, it also produced a .config
and a .manifest
file. I was wondering what these were and if they are important to the actual running of the application.
问题:
回答1:
Read this:
What is a manifest file:
A manifest is an XML document that can be an external XML file or a resource embedded inside an application or an assembly. The manifest of an isolated application is used to manage the names and versions of shared side-by-side assemblies to which the application should bind at run time. The manifest of a side-by-side assembly specifies its dependencies on names, versions, resources, and other assemblies.
How to control it:
By default the project properties of new projects are set to generate a manifest file.However it is possible to disable generation of the manifest for a project using the Generate Manifest property of the project. When this property is set to Yes, the manifest for this project is generated. Otherwise the linker ignores assembly information when resolving dependencies of the application code, and does not generate the manifest.
and
The build system in Visual Studio allows the manifest to be embedded in the final binary application file, or generated as an external file. This behavior is controlled by the Embed Manifest option in the Project Properties dialog. To set this property, open the Manifest Tool node, then select Input and Output. If the manifest is not embedded, it is generated as an external file and saved in the same directory as the final binary. If the manifest is embedded, Visual Studio embeds the final manifests.
taken from here
also, you can control it from here. Project Properties>>Application tab
回答2:
The .manifest
file is important, as it stores important metadata about your application. Note, however, that the manifest is not absolutely required you only need to be aware of potential side effects of deleting it. 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.
It is also possible to embed the manifest in the assembly itself, so that you only have a single file to distribute.
The .config
files can store important information when certain features of Visual Studio are used. They are usually used to store settings specified in a .settings
file in your solution. However, if you don't know what the files are, it is unlikely that you are using those features.
回答3:
Yes It is important, as if you are launching the new version, and update existing setup, of application, this features will only help to identify current version of application installed on the system, and on basis of that only you will be able to update it.
回答4:
.config
This file can contain informations about your target-framework. In this file are also stored settings-variables with the application-scope.
.manifest
This file can conatain informations about your application. Here you can define that your application requires administrator-rights.