Get assembly version in PCL
问题 I have the following line of code in .NET 4.5 that I am trying to build as Portable Class Library. It's purpose is to get assembly version: this.GetType().Assembly.GetName().Version.Major; The problem is that Assembly.GetName() is not available in PCL. Is there a way to get assembly version in PCL? I know it is possible to parse Assembly.FullName, but I want a better solution. 回答1: public static string Version { get { var assembly = typeof(MyType).GetTypeInfo().Assembly; // In some PCL