Reputation: 985
We are updating from .NET 3.1 to .NET 6. After deploying the Azure Function App, the "Runtime version" displays, "Error", and the below message is on the overview page.
Could not load type 'System.Environment' from assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Upvotes: 12
Views: 8015
Reputation: 11
Just as an addition, for anyone like me following these answers in a local development environment; ensure that your Functions Core Tools are up-to-date too. If they're not you'll see the error described in this post, even after updating your functions config. To verify, check the Runtime version when your solution starts (e.g. Function Runtime Version: 4.25.3.21264) and if necessary, update the core tools as described in the MS guidance: Develop Azure Functions locally using Core Tools
Upvotes: 0
Reputation: 985
The solution is to update the function app to version 4.
Updating the following project values to:
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
and
Using this command:
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
Upvotes: 22