Tim*_*Tim 9 compact-framework visual-studio-2008 windows-mobile-6
我很难在程序集/ exe中获取版本信息.关于这一点似乎有很多问题,但没有一个能帮助我解决这个问题.
在我的exe中包含版本信息似乎是基本和简单的,但是当我从资源管理器查看上下文菜单时它没有显示(右键单击 - >属性 - >详细信息)
如何在我的C#compact framework/WinMobile 6.0项目中添加版本信息(不使用插件)?
这是默认的assemblyinfo.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("TestingVerInfo")]
[assembly: AssemblyDescription("hello")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("world")]
[assembly: AssemblyProduct("TestingVerInfo")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyTrademark("gggg")]
[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("5e5fffea-0c9d-4394-9a0f-d24b7e7db9ed")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)
这里有不太令人印象深刻的文件细节:

也许我不明白这个问题,但包括版本信息就像设置assembly: [AssemblyVersion][1]属性一样简单.您可以使用以下内容查询它:
var version = Assembly.GetExecutingAssembly().GetName().Version;
Run Code Online (Sandbox Code Playgroud)
UPDATE
那么这是一个非常奇怪的行为.我知道我的应用程序和程序集中有版本信息,因此我打开了Studio并创建了一个新的智能设备项目并保留了所有默认值.果然,我得到了你看到的行为 - 也就是说没有版本信息.WTF?我回去打开了一个存根项目,它确实在二进制AssemblyInfo.cs文件中有版本信息,文件确实没有什么不同.
我玩了一下,事实证明,如果您将项目的目标平台从"Windows Mobile Xxxx"更改为"Windows CE"(如果执行此操作,您仍然可以部署到WinMo目标),那么版本信息会结束在二进制文件中.不知道为什么会出现这种情况 - WinMo配置的编译器命令行必须与CE配置不同.
| 归档时间: |
|
| 查看次数: |
1506 次 |
| 最近记录: |