c# - 更改 TargetingFramework 后无法加载文件或程序集...
问题描述
我刚刚将 .csproj 从 更改为<TargetFramework>netcoreapp3.1</TargetFramework>
调试 <TargetFramework>netstandard2.0</TargetFramework>
时,我收到以下信息:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly '..., Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified. at CDMToJSON.Program.Main(String[] args)
Sources\CDMToJSON\bin\Debug\netstandard2.0
我尝试在文件夹Newtonsoft.Json
(
因此,如何在更改目标框架后正确添加所有这些 .dll?
解决方案
netstandard
TFM 仅适用于图书馆。它们不能用于可直接执行的项目,例如桌面应用程序、控制台应用程序或单元测试项目。
您需要选择您的程序将定位的具体运行时,例如netcoreapp3.1
or net5.0
,然后定位它。
推荐阅读
- java - 用公共构造函数Java声明一个私有静态嵌套类?
- flutter - Flutter for Web 和 for Mobile Apps 有什么区别?
- .htaccess - 哪些正确的权限必须具有网站的文件夹和文件?
- javascript - 如何制作根据特定输入数字变量变化的进度条?
- javascript - 使用 javascript for 循环处理异步数组
- android - 将 LiveDataTestUtil 与 Kotest 一起使用
- python - 为什么我的 Python 多处理结果没有附加到回调上?
- google-sheets - Googlesheet 中的 importxml 函数
- python - 使用 python 对 .csv 文件中的列求和
- javascript - 如何检查数组中的每个元素以查看它是否存在于另一个数组中,并将第一个数组中的元素替换为其他元素?