Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Version info not working in Visual Studio 2008 - Compact framework/Win Mobile 6

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:

enter image description here

like image 279
Tim Avatar asked Oct 25 '11 16:10

Tim


Video Answer


2 Answers

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:

 var version = Assembly.GetExecutingAssembly().GetName().Version;

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.

like image 114
ctacke Avatar answered Oct 07 '22 21:10

ctacke


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.

like image 1
competent_tech Avatar answered Oct 07 '22 20:10

competent_tech