Migrate Azure Function app from .NET Core v2 to v3
For migrating an Azure Function app from .NET Core v2 to v3 follow the following steps
to
- Unload the Azure function project by right clicking the project and selecting unload.
- Change
<propertygroup>
<targetframework>netcoreapp2.2</targetframework>
<azurefunctionsversion>v2</azurefunctionsversion>
</propertygroup>
to
<propertygroup>
<targetframework>netcoreapp3.1</targetframework>
<azurefunctionsversion>v3</azurefunctionsversion>
</propertygroup>
- Reload the Azure function project by right clicking the unloaded project
- Update the Microsoft.NET.Sdk.Functions nuget package to version 3.0.2 or higher
- Update the Microsoft.Azure.WebJobs.Extensions (when installed) to version 4.0.0 or higher
- In the local.settings.json change the FUNCTIONS_EXTENSION_VERSION setting to "~3"
- When I for the first time tried to start the converted Azure function project I got the message "no Functions runtime available that matches the version specified in the project.". I fixed this by following these steps
- Close existing Visual studio projects / solutions
- Updating Visual Studio to the latest update
- Create a new Azure Function project
- By the template setting check if the .NET Core 3 framework option is there, if not check if you have a spinner below in the screen, wait a while. The spinner did not stop spinning, I cancelled the screen and retried and after that I could create a .NET Core 3 framework project.
- Just create a default timer project.
- Close Visual studio and restart your converted Azure function project
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.Solution: Change in the project file azurefunctionsversion from v2 to v3
File name: 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Comments