版本信息在 Visual Studio 2008 - Compact Framework/Win Mobile 6 中不起作用
我很难在程序集/exe 中获取版本信息。似乎有很多与此相关的问题,但没有一个可以帮助我解决问题。
能够在我的 exe 中包含版本信息似乎是基本且简单的,但是当我从资源管理器中查看上下文菜单时,它不会显示(右键单击 - >属性 - >详细信息)
如何添加版本信息(不使用插件)到我的 C# 紧凑框架/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")]
这是不太令人印象深刻的文件详细信息:
I am having a hard time getting version info in my assembly/exe. There seem to be a lot of questions regarding this but none help me with resolving the issue.
It seems to basic and simple to be able to include version info in my exe, but it does not show up when I look in the context menu from explorer (right click->properties->details)
How can I add version info (Without using plugins) to my C# compact framework/WinMobile 6.0 project?
Here is the default 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")]
And here is the less than impressive file details:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我不明白这个问题,但包含版本信息就像设置
assembly: [AssemblyVersion][1]
属性一样简单。您可以使用如下方式查询它:更新
这是一个非常奇怪的行为。我知道我的应用程序和程序集中有版本信息,因此我打开 Studio 并创建一个新的智能设备项目并保留所有默认值。果然,我得到了你看到的行为 - 也就是说没有版本信息。搞什么?我返回并打开一个存根项目,该项目在二进制文件中包含版本信息,并且
AssemblyInfo.cs
文件确实没有什么不同。我玩了一下,结果发现,如果您将项目的目标平台从“Windows Mobile Xxxx”更改为“Windows CE”(如果您这样做,您仍然可以部署到 WinMo 目标) )然后版本信息确实最终出现在二进制文件中。不知道为什么会出现这种情况 - WinMo 配置的编译器命令行必须与 CE 配置不同。
Maybe I don't understand the question, but including version info is as simple as setting the
assembly: [AssemblyVersion][1]
attribute. You can query it back using something like this:UPDATE
Well here's a really strange behavior. I knew that I had version info in my apps and assemblies, so I opened up Studio and created a new Smart Device project and left all of the defaults. Sure enough, I got the behavior you see - that is to say no version info. WTF? I went back and opened a stub project that did have the version info in the binary and the
AssemblyInfo.cs
file really was no different.I played around a bit and it turns out that if you change the target platform of your Project From "Windows Mobile Xxxx" to "Windows CE" (you can still deploy to a WinMo target if you do this) then the version info does end up in the binary. No idea why this might be the case - the compiler command line for the WinMo configuration must be different than the CE configuration.
为 Windows Mobile 生成的应用程序不是使用标准 Windows 操作系统可执行格式创建的。这意味着您正在运行的 Windows 操作系统不知道如何从文件中提取信息以填充详细信息选项卡。
尽管如此,版本信息仍然嵌入在应用程序中,并且可以在移动设备上使用。如果您需要在应用程序中向用户提供此信息(例如,“关于”框),可以使用 coredll 方法(包括 GetFileVersionInfo 和 VerQueryValue)检索此数据。
我们检索此数据的类大约有 350 行长,所以我认为在这里发布不合适,而且我无法快速找到我们最初想法的来源。如果需要,我可以对此进行更多研究。
Applications generated for Windows Mobile are not created using a standard Windows operating system executable format. This means that the Windows operating system that you are running does not know how to extract the information from the file in order to populate the details tab.
Having said that, the version information is still embedded in the application and is available on the mobile device. If you need to present this information to your users within your application (the about box, for example), there are ways to retrieve this data using coredll methods including GetFileVersionInfo and VerQueryValue.
Our class to retrieve this data is about 350 lines long, so I didn't think it appropriate to post here and I could not quickly find the source where we got the original idea from. I can do additional research on this if needed.