azure-functions-host: Error message "Error configuring services in an external startup class. ---> System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0" when migrating to .NET 8 with in-process model

I followed this guideline to migrate azure function in-process model to .NET 8 (https://github.com/Azure/azure-functions-host/issues/9951#issuecomment-2220820760). But after deploying to azure window function app, I got following error message even all functions is able working well

Microsoft.Azure.WebJobs.Script.ExternalStartupException : Error configuring services in an external startup class. ---> System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. at XXX.Startup.Configure(IFunctionsHostBuilder builder) at Startup.cs : 84 at Microsoft.Azure.Functions.Extensions.DependencyInjection.FunctionsStartup.Configure(WebJobsBuilderContext context,IWebJobsBuilder builder) at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureStartup(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 162 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureAndLogUserConfiguredServices(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 130 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseWebJobsStartup(IWebJobsBuilder builder,Type startupType,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 115 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseExternalStartup(IWebJobsBuilder builder,IWebJobsStartupTypeLocator startupTypeLocator,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 213 at Microsoft.Azure.WebJobs.Script.ScriptHostBuilderExtensions.<>c__DisplayClass7_0.<AddScriptHostCore>b__1(HostBuilderContext context,IWebJobsBuilder webJobsBuilder) at /_/src/WebJobs.Script/ScriptHostBuilderExtensions.cs : 235 End of inner exception

How do I find the System.ComponentModel package with Version=8.0.0.0? I see the latest version from Nuget is 4.3.0 instead of 8.0.0.0.

Does anyone know the issue and help me how to fix it?

Thank you, Tuan Vo

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (1 by maintainers)

Most upvoted comments

If it is an error in your local setup of In-Process, you need to add this in your local.settings.json: “FUNCTIONS_INPROC_NET8_ENABLED”: “1”

After the .Net 8 upgrade, everything worked fine locally. I only saw the original error mentioned on this thread when I published my function app to Azure. Sounds like our issues are different.

Seeing the same issue on two of our function apps (running locally - Windows 11, VS 2022, haven’t tried running in Azure yet)

All I did was upgrade two .NET 6 Function apps to target .NET 8 (leaving them as in-process functions). I also have the _FunctionsSkipCleanOutput set to true in my csproj file. I updated my local.settings.json to have the required settings for .NET 8 in-process support:

"FUNCTIONS_INPROC_NET8_ENABLED": "1"
"FUNCTIONS_WORKER_RUNTIME": "dotnet"

Both of these apps fail to start when I hit F5. One fails with:

Error configuring services in an external startup class. XXX: Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The other one fails with:

Error configuring services in an external startup class. XXX: Could not load file or assembly 'System.Data.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

In Visual Studio, I also went to Tools -> Options -> Projects and Solution -> Azure Functions. Checked to make sure I had the most recent Azure Function toolsets and they are up to date.