![](/img/trans.png)
[英]File version 0.0.0.0 in Windows Explorer file properties 'Details' tab of .exe compiled with Visual Studio 2017
[英]Exe does not contain Version in Properties/Details
我有一个C#项目,并指定了程序集和文件版本。 但是在Project.exe的“属性/详细信息”下,“文件版本”字段为空。 我必须在项目设置中设置某些内容还是正常现象?
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是所需的版本)。
因此,我通过以下方式解决了我的问题:
所以问题是:如果为图标指定Win32-Resource,则没有清单文件将嵌入到输出exe中。 在这种情况下,您可能必须向该资源添加版本资源以包括版本数据。 在这种情况下,您必须为您进行的每个构建手动定义版本,构建等(我发现没有其他方法可以避免这种行为)。 奇怪的是,即使不添加版本资源,软件本身仍将能够从自己的AssemblyInformation获取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.