简体   繁体   English

Exe在“属性/详细信息”中不包含“版本”

[英]Exe does not contain Version in Properties/Details

I have a C# project and have specified assembly and file versions. 我有一个C#项目,并指定了程序集和文件版本。 But under the Properties/Details of the Project.exe the field File version is empty. 但是在Project.exe的“属性/详细信息”下,“文件版本”字段为空。 Do I have to set up something in project settings or is it a normal behavior? 我必须在项目设置中设置某些内容还是正常现象?

Assembly.cs: Assembly.cs:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Application")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Firm")]
[assembly: AssemblyProduct("Application")]
[assembly: AssemblyCopyright("Firm ©  2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("long guid")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersionAttribute("1.0.1")]

仔细检查可执行项目的AssemblyInfo.cs文件,并确保该文件具有正确设置的属性[assembly: AssemblyFileVersion("1.0.0.0")] (其中1.0.0.0是所需的版本)。

So, I have solved my problem the following way: 因此,我通过以下方式解决了我的问题:

  • I have set under Project properties/Application back to "Icon and Manifest" and specified the single icon for my project 我在“项目属性/应用程序”下设置回“图标和清单”,并为我的项目指定了单个图标
  • To embed multiple icons into my exe without Win32-Resource I have used InsertIcons.exe 要在没有Win32资源的情况下将多个图标嵌入到我的exe中,我使用了InsertIcons.exe

So the problem was: if you specify a Win32-Resource for your Icons, then no manifest file will be embedded into the output exe. 所以问题是:如果为图标指定Win32-Resource,则没有清单文件将嵌入到输出exe中。 In this case you possibly have to add to this resource a version resource to include the version data. 在这种情况下,您可能必须向该资源添加版本资源以包括版本数据。 In this case you have to define the version, build etc. manually for every build you make (I have found no other way to avoid this behavior). 在这种情况下,您必须为您进行的每个构建手动定义版本,构建等(我发现没有其他方法可以避免这种行为)。 Strangely the software itself will be still able to get data from own AssemblyInformation even without adding version resource. 奇怪的是,即使不添加版本资源,软件本身仍将能够从自己的AssemblyInformation获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM