It is always fun to return to one of my favorite topics: Errors and warnings, causes and solutions, this time on Azure. It was not a fun night yesterday! And all of that because of the nightmare that sometimes I needed to prepare our developer tools to be fit to develop Azure Services.
Some time ago, November 14, 2023, to be exact, Microsoft announced the global availability of Azure Functions supports .NET 8 in the isolated worker model. Support is available for Windows and Linux on the Consumption, Elastic Premium, and App Service plan hosting options.
So, last night, I decided to create an Azure Function using .NET 8, and to my surprise, the .NET 8 Isolated (Long Term Support) Function worker was missing from the Azure Function project in Visual Studio 2022.
Of course, the first assumption I made was I didn’t have the .NET 8 installed. And, in fact, it wasn’t! So I went to the Download .NET SDKs for Visual Studio page and installed the .NET 8.0.
However, after installing and restarting everything, including the laptop, the .NET 8 Function worker was still missing from the Azure Function project in Visual Studio 2022.
Causes
The cause of this problem or behavior is related to having currently installed obsolete Azure Function tools and/or Visual Studio version on your machine.
Solutions
The solution to this problem is not quite as intuitive as we like it but nevertheless simple to accomplish once you know what to do.
To resolve this issue/behavior, you need to perform several steps.
Step 1: As I mentioned above, make sure you have installed in your machine the .NET 8.0 SDK.
- If you don’t have .NET 8.0 SDK installed, access the Download .NET SDKs for Visual Studio page and install it.
Step 2: Visual Studio version matters! You need to upgrade your Visual Studio 2020 to version 17.8 or above. (I am not sure if the first version to support this Function Worker is 17.8, but I believe so). To upgrade Visual Studio you need to:
- Open Visual Studio 2022 and access the following menu option: Help > Check for Updates.
- In my case, I had an old version, 17.6.3, that does not support .NET 8.0 Function worker. Click Update.
- Once the update is complete, click OK.
Step 3: Install the latest Azure Functions toolsets and templates. After upgrading the Visual Studio, we also need to make sure that we have the latest Azure Functions toolsets and templates. To do that, we need to:
- Open Visual Studio 2022 and access the following menu option: Tools> Options...
- In the Options window, on the left menu three, select the option Projects and Solutions > Azure Functions. And then click Check for updates.
- If it exists updates, click on Download & Install.
- Once the version is installed or if there isn’t any update, a message will appear saying Azure Functions toolsets and templates are up to date. Click OK.
- Close Visual Studio.
Step 4: (optional but recommended) Remove AzureFunctionsTools folder from LocalAppData
Maybe this step is not required, but after all the failed attempts, this “recipe” worked, at least for me. That being said, I also recommend carrying out all the optional steps.
To accomplish this, you need to:
- On the file system, access to: %LocalAppData%
- And delete the AzureFunctionTools folder.
Step 5: Restart the machine
I try to access Visual Studio before restarting the machine without success. Once I restarted everything, including the machine, I once again tried to access Visual Studio to create an Azure Function project, and the .NET 8 Isolated (Long Term Support) Function worker was finally available for me to use:
Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego!