I want to display my version number of the application in my application, and the easiest way to do this is to use the version number for the build.
var assembly = System.Reflection.Assembly.GetExecutingAssembly(); var name = assembly.GetName(); return String.Format("Version {0}.{1}", name.Version.Major, name.Version.Minor);
I can complete the build without problems, but calling GetName() returns a MethodAccessException with this message
An attempt was made by the transparent security method "MainPage..ctor ()" to access the critical critical method "Error System.Reflection.Assembly.GetName ()".
Why is this happening, is there anything I can do about it, and if there is no other way to get the build version?
source share