首页 > 解决方案 > 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 引用(虽然,公钥与错误消息中显示的不同),但问题仍然存在。知道有什么问题吗?

谢谢

标签: c#.netmsbuild.net-standard

解决方案


推荐阅读