In my c# applications I usually get the version (to show the customer) using the following code:
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
This does not work in Windows Phone 7 (it hangs the emulator, and phone crashing is a no-no for MS).
So, how do I get the version of the executing on a windows phone 7 device??
[Update] as noted in the comments below, calling GetName() in a wp7 app seems to be the problem.
Does parsing it out of
Assembly.GetExecutingAssembly().FullName
work for you?
example output: SomeApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
edit: don't need to go through ManifestModule
Try this:
First, I think it's more apt to use the assembly's file version info for conveying the application version to the user. See http://techblog.ranjanbanerji.com/post/2008/06/26/Net-Assembly-Vs-File-Versions.aspx
Second, what about doing this:
is fairly clean as well.