TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kunjahamed P
NA
376
42.3k
.net Standard 2.0 class library produce error when adding re
Jan 17 2020 9:47 AM
Created a .net Standard 2.0 class library, and then used it in a console application created by targetting .netframework 4.6.1 and dot net core 2.1. when running web application the blow exception was thrown.
Could not load file or assembly 'ChoETL.JSON.Core, Version=1.1.0.5, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
I tested same library with project reference in .net core web application and there was no error. when try with published DLL it show error in both core and framework application
Dotnet standard class library project file is
```
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ChoETL.JSON.NETStandard" Version="1.1.0.5-beta3" />
<PackageReference Include="ChoETL.NETStandard" Version="1.1.0.5-beta3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
</Project>
```
early when adding project reference is .netframework 4.6.1 it show same error, then adding following setting in property group (project file) it disappear
<DependsOnNETStandard>true</DependsOnNETStandard>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
and is there any proper way to publish dotnet standard libary to work both .netframework 4.6.1 and dot net core 2.1
Reply
Answers (
6
)
Inserting Data To SQL Global Temporary Table From ASP.NET C#
Connect remote to database C#