How to change the application version at runtime on C#

Asked

Viewed 271 times

0

I need to change the application version from 1.0.0.0 to 1.1.0.0 at runtime, as I can do since the Productversion property is just get;

  • I believe it is not possible. Can you explain why you want to change the version in runtime?

  • As you have already said, there is no way to change it at runtime: public static string ProductVersion { get; }.

  • Cannot be { get; set; } ?

1 answer

2

I believe that at runtime is not the ideal way to do this.

The ideal way to update this version id would be during your Continue Integration process, for example, I use VSTS (Visual Studio Team Services) for my Devops scenario, and make just the change you’re needing.

During my automated build process, I run a powershell script (or even a vsts task) that accesses the assemblyinfo.Cs file (in the case of c# of course), and updates that version ID, according to the build ID, so that if necessary I can track that version 1.0.0.10293 was generated by build with same ID.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.