In C# one can use System.Version.Assembly to get the version of a running app. However this doesn't appear to exist in Silverlight for Windows Phone. Is there an alternative?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
I don't how @henry accepted the answer because all answers are talking about Dll version but when one is talking about getting the version of windows phone app that means version of app on the market. I don't know about others but I really don't care about the version of dll and also I use market version to label the source in source control.
When a developer upload XAP on the market he/she specifies the version of XAP which can be different then the dll version, while processing Market reads information from WMAppManifest.xml file and write backs the version you specify on the XAP submission page.
So the desired version is available in WMappManifest.xml file which you can read by XmlReader like following;
Here is sample WMAppManifest.xml
So you can read whatever information you want from App xml tag the same way as we read version from app tag. e.g. publisher Id or Product Id
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:
On Phone 7 there is no clean way to get the version. The best thing to do is parse the Full Name (which is the only exposed property) for the version string:
You can use the GetExecutingAssembly method and the AssemblyName class to find this information.