简体   繁体   中英

.NET Standard Nuget References

I am making a class library in .NET Standard, which I wish to be usable from Windows and Android. However, when I try to reference the project or the project output directly, then I get AssemblyNotFoundException s at runtime, with a different one for each NuGet package that my .NET Standard project references. Adding each NuGet package to every project that references the .NET Standard project makes this problem go away, but it feels like an unsustainable solution. What is the best way to resolve the dependencies in a .NET Standard project? I am using Visual Studio 2017, my console project is .NET 4.7, and my .NET Standard project is .NET Standard 1.6.

I have already referenced NETStandard.Library from my console project, but it does not work. Type such as System.ValueTuple still throw exceptions when I attempt to use them.

Right now, the exception I am getting upon attempting to run my program is this:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime.Serialization.Formatters, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

Which makes sense, as I use serialization in my .NET Standard library.

您是否尝试将.Net Standard 1.4用于您引用的库?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM