簡體   English   中英

.NET標准Nuget參考

[英].NET Standard Nuget References

我正在.NET Standard中創建一個類庫,我希望它可以在Windows和Android中使用。 但是,當我嘗試直接引用項目或項目輸出時,我在運行時獲得AssemblyNotFoundException ,而我的.NET Standard項目引用的每個NuGet包都有一個不同的。 將每個NuGet包添加到引用.NET Standard項目的每個項目都會使這個問題消失,但這感覺就像一個不可持續的解決方案。 解決.NET Standard項目中的依賴項的最佳方法是什么? 我使用的是Visual Studio 2017,我的控制台項目是.NET 4.7,我的.NET Standard項目是.NET Standard 1.6。

我已經從我的控制台項目中引用了NETStandard.Library,但它不起作用。 當我嘗試使用它們時,類型如System.ValueTuple仍會拋出異常。

現在,我試圖運行我的程序時遇到的異常是這樣的:

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

這是有道理的,因為我在.NET標准庫中使用序列化。

您是否嘗試將.Net Standard 1.4用於您引用的庫?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM