Running our Azure Function App locally in Rider or VS 2022 has suddenly stopped working with the following error:
This version of the Azure Functions Core Tools requires your project to reference version 4.5.0 or later of Microsoft.NET.Sdk.Functions. Please update to the latest version.
We had been at v 4.0.1 and updated via Nuget to 4.5. However we still cannot run the app.
From VS 2022 it pops up message: There is no Functions runtime available that matches the version specified in the project.
From Rider, we get the same message as before:
This version of the Azure Functions Core Tools requires your project to reference version 4.5.0 or later of Microsoft.NET.Sdk.Functions.
Any suggestions?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>V4</AzureFunctionsVersion>
</PropertyGroup>
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ExpirationList.cs" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Graph" Version="5.56.0" />
<PackageReference Include="Microsoft.Graph.Core" Version="3.1.12" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.5.0" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="26.2.5" />
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="26.2.5" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Asap.Mgmt.WebApi.Data\Asap.Mgmt.WebApi.Data.csproj" />
<ProjectReference Include="..\OidcApiAuthorization\OidcApiAuthorization.csproj" />
</ItemGroup>
</Project>
public class AgendaApi
{
private readonly IApiAuthorization _apiAuthorization;
private readonly IConfigurationRoot _config;
UtilRepository _util;
public AgendaApi(IApiAuthorization apiAuthorization)
{
_apiAuthorization = apiAuthorization;
_config = new ConfigurationBuilder()
.AddJsonFile("local.settings.json", true)
.AddEnvironmentVariables()
.Build();
_util = new UtilRepository();
}
[FunctionName("GenerateAgenda2")]
public async Task<IActionResult> GenerateAgenda2(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "agenda/generateagenda2/hearing/{hearingid}")]
HttpRequest req, ILogger log, ExecutionContext context, int hearingid)
{
log.LogInformation("Reports - Generate Agenda 2");
var repo = new AgendaRepository(_config, log, _util);
var (fileContent, contentType) = await repo.GenerateAgenda2(hearingid);
return new FileStreamResult(fileContent, contentType);
}
}
}
You should update the Microsoft.NET.Sdk.Functions library from NuGet up to 4.5.0
Then follow these instructions: https://itsallinthecode.com/fixing-there-is-no-functions-runtime-available-in-visual-studio. You have to go to Tools > Options > Project and Solutions > Azure Functions > Click on "Check for updates" And when the "Download & Install" button appears, just click it, wait few seconds and relaunch the local functions, they should work
Attempted to upgrade the Microsoft.NET.Sdk.Functions to 4.5 but it didn't work for me. While it might work for some, this wasn’t feasible in my case, as other environments were running fine, and the issue was only occurring on my machine.
Here’s what worked for me:
%LocalAppData%\AzureFunctionsTools and restart the VS. Note: It's crucial to have .NET 6.0 installed for this step to work.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With