How can I access my build version number in a partial trust environment (without FileIOPermission)

I am trying to access the version number of my assembly at runtime.

The code I use for this requires a FileIOPermission, which I do not want to provide (I'm in the Internet zone)

this.GetType().Assembly.GetName().Version;

Is there any other way to access the version number that does not require upgrading?

+3
source share
2 answers

This is not exactly the same version number (this is "AssemblyFileVersion", not the "AssemblyVersion" attribute), but you can use the following line of code:

System.Windows.Forms.Application.ProductVersion

Returns a string.

If you are doing automatic assemblies, you need to remember to increase both numbers.

ClickOnce, :

System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion

,

+3

AssemblyVersion FileIOPermission, Assembly:: FullName.

+1

Source: https://habr.com/ru/post/1703432/


All Articles