Recently, I was getting this error in one of ASP.NET .Net Frameworks 4.7 applications. This error persisted on the server after deployment. This is surprising for an asp.net frameworks application where I am not using any .net standard components but still I am getting this error after publishing the applications in IIS.

This application is an existing project which was running smoothly, I simply modified some parts and updated some libraries with recent versions.

Exact Error:

System.IO.FileNotFoundException: ‘Could not load file or assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51′ or one of its dependencies. The system cannot find the file specified.’

I quickly checked package.config to inspect whether my solution is having any .NET standard libraries by mistake. However, there were none .NET core or .net standard libraries or dependencies added in this solution. By the way, the solution was running perfectly on my local development pc. 🙁

After investing some time in research and google, I found that there are some libraries, the latest version of .NET frameworks or Visual studio which implements .NET Standard 2.0.

.NET Standard is a collection of APIs that must be provided by .NET Standard compatible implementations.

A reference assembly only contains contracts. This means that it contains no implementation. The assembly you are trying to load contains the .NET Standard 2.0 contracts.

A contract looks like this: https://github.com/dotnet/standard/blob/master/netstandard/ref/mscorlib.cs

Solution 1

I downloaded .NET standard library 2.0 manually and pasted it into the bin folder of the IIS application. This simple trick works for me. You can copy and paste the dll from local pc as well.

.net standard library (netstandard.dll): C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\netstandard.dll

Solution 2

Install NetStandard.Library 2.0.0.0 from NuGet.

Set Copy Local to true in netstandard.dll properties.

Open Solution Explorer –> right click on netstandard.dll –>Set Copy Local to true as shown:

Solution 3

This solution is based on google finding.

Install the NetStandard.Library via NuGet
Manually editing the .csproj file and adding the reference.

<Reference Include="netstandard" />

Expanding project–>References in the VS Solution Explorer, right clicking on ‘netstandard’ and showing the properties page and setting “Copy Local” to true.

Above three solutions can be used for resolving the error mentioned.

By Rijwan Ansari

MVP, CSM, CSPO, MCP, MCTS. Sr. Software Developer. Expertise in ASP.NET MVC, Angular, AngularJs, .Net Core, C#.NET, Azure, Cognitive Services, Machine Learning, SharePoint, Azure Services, and tools, Requirement Analysis, Team Management, Pre-Sales and more. Ability to work independently and Team, handle pressure and meet commitment. Excellence Communication and adjust in any environment

Leave a Reply

Your email address will not be published. Required fields are marked *