kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Get all kandi verified functions for this library.
azure description: "This is an Azure Search demo website based on data from the New York City Open Data initiative. Jobs listed here should not be considered active." urlFragment: search-dotnet-asp-net-mvc-jobs
No Code Snippets are available at this moment for search-dotnet-asp-net-mvc-jobs.
Why is an Azure Function on .NET 6 looking for System.ComponentModel Version 22.214.171.124?Asked 2022-Mar-30 at 09:48
I am deploying an Azure Function called "Bridge" to Azure, targeting .NET 6. The project is referencing a class library called "DBLibrary" that I wrote, and that library is targeting .NET Standard 2.1. The Azure Function can be run locally on my PC without runtime errors.
When I publish the Azure Function to Azure, I see in Azure Portal a "Functions runtime error" which says:
Could not load file or assembly 'System.ComponentModel, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
I do not target System.ComponentModel directly, and I don't see a nuget package version 6.0.0 for "System.ComponentModel" available from any nuget feed. Why is the Azure function looking for this version 6.0.0 of System.ComponentModel? If that version does exist, why can't the Azure Function find it?
Here are the relevant parts of the csproj for the "Bridge" Azure Function:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <AzureFunctionsVersion>v4</AzureFunctionsVersion> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" /> <PackageReference Include="Microsoft.Extensions.Azure" Version="1.1.1" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\DBLibrary\DBLibrary.csproj" /> </ItemGroup> </Project>
Here are the relevant sections of the csproj for the "DBLibrary" class library that is referenced by the Azure Function project:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.1</TargetFramework> <ApplicationIcon /> <OutputType>Library</OutputType> <StartupObject /> </PropertyGroup> <ItemGroup> <PackageReference Include="Azure.Storage.Blobs" Version="12.10.0" /> <PackageReference Include="Dapper" Version="2.0.123" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.3" /> <PackageReference Include="System.Text.Json" Version="6.0.2" /> </ItemGroup> </Project>
I have tried setting _FunctionsSkipCleanOutput to true in the Azure Functions csproj because that was offered as a potential solution to nuget package resolution issues here: https://github.com/Azure/azure-functions-host/issues/7061 That solution did not change the runtime error I saw in the Azure portal.
ANSWERAnswered 2022-Feb-25 at 10:33
The .net standard you are using
2.1 but ,
Microsoft.Azure.Functions.Extensions can be support upto
.NET Standard 2.0
You should add the below package to your function app and deploy to Azure again.
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 5.0.0-rc.2.20475.6
No vulnerabilities reported