c# - VS 成功时 MSBuild 构建失败
问题描述
我正在尝试从 MSBuild 构建一个 .NET 4.7 项目。它从 VS 2017 开始构建良好,但是,MSBuild 失败并显示以下错误消息:
Program.cs(25,18): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a ref
erence to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [C:\work\automation\Apps\First\src\First\First.csproj]
Program.cs(24,27): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a ref
erence to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [C:\work\automation\Apps\First\src\First\First.csproj]
我不确定它为什么要求 netstandard 2.0,这不是我的项目,但我猜某些依赖项需要 netstandard。无论如何,我已经通过 nuget 添加了 netstadard 2.0 引用(虽然,公钥与错误消息中显示的不同),但问题仍然存在。知道有什么问题吗?
谢谢
解决方案
推荐阅读
- node.js - 无法在带有 Node.js 10.x 的 64 位 Windows 上使用 node-sass?
- javascript - iframe 加载在父页面中加载的 javascript,但不从磁盘缓存加载
- spring - 请求正文对象未验证
- git - 我们如何在面向服务器的工作流程中有效地使用 Git?
- php - PHP - WordPress 所需的 MySQL 扩展
- c - 线程在 pthread_create 之后立即执行?
- javascript - 如何在选择框中显示类别以更新记录?
- python-2.7 - 在python中模拟请求库的单元测试抛出没有名为mock的模块
- nuget - 带有命令==自定义选项的 VSO/Azure 开发操作中的 Nuget 2.* 任务
- c++ - 将多个嵌套的模板类传递给模板函数