Upgrading Functions Runtime from V2 to V3

Posted by

I recently created a build pipeline in Azure DevOps for my Azure Functions sample project. I wanted a repeatable process to build my admitedly small project as I upgraded it from the V2 to V3 runtime. I wasn’t expecting too much trouble, but as with any upgrade, things are never completely smooth.

Reasons to Upgrade

From a .NET perspective, the strongest reason to move to the V3 runtime is to unlock the features available in .NET Core 3.1. There are many new language features and a bunch of performance improvements that make for a compelling upgrade. .NET Core 3.1 is the Long-Term Support version of .NET Core, so you can run functions under this version for a long time without needing to upgrade.

It’s a good time to upgrade functions that are built on the V1 runtime to V2 or V3. Microsoft aren’t deprecating any runtime versions yet, but I can’t imagine this will be true forever. On the bright side, Azure services typically provide a long notice period before deprecation, so you likely won’t be blindsided with a rush upgrade.

Upgrade Process

The first step was to edit the functions project file to use netcoreapp3.1 as the target framework, along with the V3 runtime that supports it:


In theory, that should have done it, but upon building the solution, I was confronted with an unexpected error:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 

Upon closer inspection of the project file, I noticed that it was referencing an old version of Microsoft.NET.Sdk.Functions, v1.0.27. That version shouldn’t be used for V2 functions, let alone V3. I updated the dependency to v3.0.1, which made the build and tests pass, locally and in Azure DevOps.

Overall, the upgrade was fairly painless. It would have been much harder to move directly from V1 to V3, as V1 is based on .NET Framework. I’ve found the best way to upgrade V1 functions projects is to create a V2 functions project alongside and copy the code over to it. In-place upgrades are difficult because of the change from .NET Framework to .NET Core.

Next Steps

Now that your project is updated, it’s time to play with all the new features of the V3 runtime, including the latest C# version, the latest tooling, and the new functions portal in Azure.

Did you find the information you were looking for? Is there something missing from this article that would make it more useful to you? Do you have a follow-up question? Feel free to reach out to me on Twitter or LinkedIn. I’d be glad to help out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s