Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot load file or assembly netstandard, Version=2.1.0.0

I have a AzureFunctions project that I needed to upgrade to .NET standard 2.1 (from 2.0) All of my other projects in the solution load and compile correctly but this AzureFunctions project is throwing this error:

Error System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

I've verified all the nuget packages are updated, what else could it be?

Thanks!

like image 628
ScottFoster1000 Avatar asked Sep 03 '19 23:09

ScottFoster1000


People also ask

Where is Netstandard located?

NET standard 2.0 types and members are all packet in a single assemblies netstandard. dll v2. 0 that can be found under C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.

What is Netstandard?

Net Standard is a specification which dictates what the Base Class Libraries of different . Net platforms should implement to unify the Base Class Libraries of different . Net Platforms. Here, Platform means full .


2 Answers

Some times you receive this error because you have referenced a library/nuget package that target the incompatible .Net standard. example: If you create project that target to .Net Core 2.2 and you try to add the library which target .net standard 2.1 then you will get the same error because .Net Core 2.2 is compatible with .net standard 2.0 or lower so you can add package/library that target to .Net Standard 2.0 or lower version. Please see the links for more details :

.Net Core and .Net Standard

.Net Standard Compatiblity Table

like image 71
Ashish Mishra Avatar answered Sep 18 '22 12:09

Ashish Mishra


I had the same problem. I eventually discovered that changing the Azure functions project properties to target .NET Core 3.1 still left the Azure function version on V2. The solution was to edit the CSPROJ and set the AzureFunctionsVersion from v2 to v3.

like image 42
Lee Cordell Avatar answered Sep 20 '22 12:09

Lee Cordell