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 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=, 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:

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 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

Research and Technology Lead | Software Architect | Full Stack .NET Expert | Tech Blogger | Community Speaker | Trainer | YouTuber. Follow me @ Md Rijwan Ansari is a high performing and technology consultant with 10 plus years of Software Development and Business Applications implementation using .NET Technologies, SharePoint, Power Platform, Data, AI, Azure and cognitive services. He is also a Microsoft Certified Trainer, C# Corner MVP, Microsoft Certified Data Analyst Associate, Microsoft Certified Azure Data Scientist Associate, CSM, CSPO, MCTS, MCP, with 15+ Microsoft Certifications. He is a research and technology lead in Tech One Global as well as leading Facebook community Cloud Experts Group and SharePoint User Group Nepal. He is a active contributor and speaker in community, C# Corner MVP and his rank at 20 among 3+ millions members. Additionally, he is knee to learn new technologies, write articles, love to contribute to the open-source community. Visit his blog RIJSAT.COM for extensive articles, courses, news, videos and issues resolution specially for developer and data engineer.

Leave a Reply

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