I get NullReferenceException when trying to get version from assemblyinfo in UWP app. Below is the code that I am using :
return typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyVersionAttribute>().Version;
I get NullReferenceException when trying to get version from assemblyinfo in UWP app. Below is the code that I am using :
return typeof(AssemblyInfo).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyVersionAttribute>().Version;
You can get version without using reflection, with code like:
PackageVersion pv= Package.Current.Id.Version;
string version= $"{pv.Major}.{pv.Minor}.{pv.Build}.{pv.Revision}";