According to this article and this code sample with the v4 runtime, it’s now possible to create an Azure Functions app using .NET Framework 4.8 with the isolated process model (it’s in preview). I’ve done this, but I can’t seem to launch or debug it in Visual Studio 2022. When I try, I get the message:
There is no Functions runtime available that matches the version specified in the project.
I assumed the version of the functions runtime was out of date on my computer, which it was. I had the 3.x version installed and so I updated it to 4.0.4736. Unfortunately, Visual Studio still won’t launch my project. Is there a way to get this to work?
The entire csproj file looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net48</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.8.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties" />
</ItemGroup>
</Project>
2
Answers
On Azure Functions v4 .NET Framework 4.8 with the VS 2022 17.3.4 version, I too got the same errors as:
I have raised the issue in the GitHub Repo of Azure Functions dotnet worker but with the preview versions of package references in the
.csproj
file, it didn’t’ worked for me.It worked with the below configuration code:
.csproj
:local.settings.json
:HttpFunction.cs
Function Code is taken from the same GitHub Repository.Result:
I found this post while figuring out this issue as well. The issue as reported and linked above by @HariKrishna was closed on GitHub, but it did contain the link to the solution that helped me:
https://github.com/Azure/azure-functions-dotnet-worker/issues/989
VS needs to be updated to at least 17.4 (preview) and after that the Azure function tools needs to be updated through Tools, Options, Projects and Solutions, Azure functions, Click Check for updates, then click Download & install.