Reputation: 4260
I have a v3 queue-triggered function that has been working fine on my Windows 10 machine. This is how the .csproj file looks like:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
I am not sure why I started getting the exception mentioned in the subject line, but the bottom line is that this function used to work well. This Stackoverflow post was not helpful to address the issue. Could it be due to upgrading the operating system to Windows 11? I did not run this function app immediately after migrating to Windows 11, so I cannot speak on that.
The full exception's stack trace is per below:
Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. at Microsoft.Azure.Functions.Extensions.DependencyInjection.FunctionsStartup.Configure(WebJobsBuilderContext context, IWebJobsBuilder builder) at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureStartup(IWebJobsStartup startup, WebJobsBuilderContext context, IWebJobsBuilder builder) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs:line 162
Any idea on what the possible solution would be as it has become a roadblock?
Upvotes: 1
Views: 880
Reputation: 40553
To preserve specific version in order to avoid upgrading to a newer version which you could add this entry to csproj
<ItemGroup>
<FunctionsPreservedDependencies Include="Microsoft.Extensions.DependencyModel.dll" />
</ItemGroup>
Upvotes: 1
Reputation: 1095
You can try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput> to the Function's project file.
like this:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
Upvotes: 0