我尝试仅使用 MSBuild 在我的构建机器上编译 .NET 4.6 C# 项目。我没有在机器上安装 Visual Studio 2015,而是安装了以下内容:
- .NET Framework 4.6 运行时
- .NET Framework 目标包
- 微软构建工具 2015
我在 cmd 中运行以下命令: "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"MySolution.sln
我得到的错误是:
"error MSB4019: The imported project "C:\Microsoft.Cpp.Defaults.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk."
我已经检查过“C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0”中存在“Microsoft.Cpp.Defaults.props”文件,但不在“C:\程序文件 (x86)\MSBuild\Microsoft.Cpp\v4.0\V140”。实际上,即使文件夹“C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140”也不存在。
我还应该做什么/安装来编译它?
最佳答案
我遇到了同样的问题。我在运行 ms build 时通过添加以下参数来修复它。
/p:VisualStudioVersion=12.0
不是 14.0。
我引用了这个答案。
External VS2013 build error "error MSB4019: The imported project <path> was not found"
关于c# - 在没有 Visual Studio 的情况下编译 .NET 4.6 C# 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32206935/