'Error "Did not find functions with language [dotnet-isolated]" in Azure Function when migrating from .NET 3 to .NET 5
I'm trying to migrate an Azure Function that works perfectly on .NET 3.1 to .NET 5. I followed Microsoft's GitHub guide and still can't get it to run or debug locally (didn't even try to publish to Azure).
I'm getting this error:
[2021-09-05T09:49:33.066Z] A host error has occurred during startup operation 'bb37a6db-b6f4-4396-bb9b-cb5ae0bba387'.
[2021-09-05T09:49:33.067Z] Microsoft.Azure.WebJobs.Script: Did not find functions with language [dotnet-isolated].
And this exception is being raised:
This is my Program.cs:
static async Task Main(string[] args)
{
var host = new HostBuilder()
.ConfigureAppConfiguration(c =>
{
c.AddCommandLine(args);
})
.ConfigureServices(s =>
{
s.AddLogging();
})
.Build();
await host.RunAsync();
}
This is my project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<UserSecretsId>76d0a5ed-221b-4b35-8ff4-3ee33d393196</UserSecretsId>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<None Remove="global.json" />
</ItemGroup>
<ItemGroup>
<Content Include="global.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.5.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="4.0.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.0.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
<PackageReference Include="System.Linq.Async" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
My local.settings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "HIDDEN",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}
My host.json:
{
"logging": {
"fileLoggingMode": "always",
"logLevel": {
//"QueueWorkers.EmailQueueWorker": "Trace",
//"QueueWorkers.EmailQueueWorker.EmailQueueWorker": "Trace",
"default": "Information",
"Function": "Trace",
"Host.Results": "Error",
"Host.Aggregator": "Trace"
},
"applicationInsights": {
//"samplingExcludedTypes": "Request",
"samplingSettings": {
"isEnabled": true
}
},
"console": {
"isEnabled": "true"
}
},
"Values": {
"AzureWebJobsStorage": "HIDDEN",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
},
"extensions": {
"queues": {
"maxDequeueCount": 5,
"maxPollingInterval": "00:00:02"
}
},
"version": "2.0"
}
Thanks
Solution 1:[1]
Had a similar problem in Visual Studio 2022, while trying to migrate a project from .net 5 to .net 6 functions...
kept telling me "Microsoft.Azure.WebJobs.Script: Did not find functions with language [dotnet-isolated]"
My Solution
1) I was missing: Program.cs
using Microsoft.Azure.Functions.Worker.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;
namespace Main.Function
{
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.Build();
host.Run();
}
}
}
2) Edit .csproj > Under ItemGroup...
Remove:
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
Replace with
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="4.0.1" />
3) Ensure OutputType is set to exe
<OutputType>Exe</OutputType>
4) Unload project and reload (delete bin and obj folder before building)
Solution 2:[2]
In Azure navigate to your Function and then change the settings:
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
Solution 3:[3]
Well, still couldn't directly launch and debug from VS 2019 but function does work if launched from CLI and debug is working.
- Add
Debugger.Launch();to Program.cs (first line of Main method) - Make sure you have
<LangVersion>preview</LangVersion>in your csproj (right after TargetFramework). This missing line was actually the critical difference that stopped my function from working. - Launch from CLI (from function folder): "func start --verbose"
Thanks
Solution 4:[4]
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dwain Browne |
| Solution 2 | Liam |
| Solution 3 | |
| Solution 4 | Romesh |



