I'm having trouble debugging a Azure function in Visual Studio 2022
I created a function using the following command line
func init queue-events --worker-runtime dotnet-isolated --target-framework net8.0
Then I added a HttpTrigger using this command
func new --template "Http Trigger" --name MyHttpTrigger
I tested out the function to see if it would start, and it works using func start
I now want to debug my function project in Visual Studio 2022, but as soon as I start it up, I run into this error. "There is no Function runtime available that matches the versions specified in the project". Not sure what to do now. The function runs with the command line, but not in Visual Studio 2022
I've even updated Visual Studio Azure functions tools/templates
For reference
dotnet --list-sdks
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.214 [C:\Program Files\dotnet\sdk]
5.0.416 [C:\Program Files\dotnet\sdk]
7.0.409 [C:\Program Files\dotnet\sdk]
8.0.105 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
func --version
Azure Functions Core Tools
Core Tools Version: 4.0.5801 Commit hash: N/A +5ac2f09758b98257e728dd1b5576ce5ea9ef68ff (64-bit)
Function Runtime Version: 4.34.1.22669
Visual Studio Verison
Microsoft Visual Studio Community 2022 (2) (64-bit) - Current
Version 17.10.0
There is no Function runtime available that matches the versions specified in the project
%LocalAppData%\AzureFunctionsTools
folder.Tools=>Options=>Projects & Solutions=>Azure functions
:I have created a dotnet isolated azure function using commands as you have mentioned.
Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.9.7
Azure Functions Core Tools
Core Tools Version: 4.0.5801
Function Runtime Version: 4.34.1.22669
.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>queue_events</RootNamespace>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.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>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}
host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}