ChrisHDog
ChrisHDog

Reputation: 4663

How do I version Azure Functions so I can query at runtime?

I have an azure function that I want to report what version of the code it is running. In other applications I am able to get this by running something of the nature:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version

However I don't a) seem to have away of putting that data into the azure function (there is no assembly information button) or b) retrieving that information (the above code snippet always returns 1.0)

Is there a way (other than just putting in a configuration setting or private variable) to pull a standard version value from an Azure function via this mechanism?

Upvotes: 2

Views: 2216

Answers (1)

David Ebbo
David Ebbo

Reputation: 43203

I assume you are currently using .csx files from the Azure portal. If you instead switch to using Visual Studio and precompiled assemblies (which is generally recommended) the code you have above should work fine.

Specifically, use the following steps to change the version:

  • Right click on the Project and choose Properties
  • Go to 'Package'
  • Change the Package version

Upvotes: 2

Related Questions