我正在尝试在 CentOS 中构建一个 VS 项目。我通过 yum install dotnet-sdk-2.2
安装了 dotnet-sdk-2.2。
当执行 dotnet msbuild myproj.vcxproj
时,我得到:
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
mtproj.vcxproj(19,3): error MSB4019: The imported project "/Microsoft.Cpp.Default.props"
was not found. Confirm that the path in the <Import> declaration is correct, and that the
file exists on disk.
谷歌搜索结果有许多解决方案,但适用于 Windows。我该怎么做才能在 Linux/CentOS 上解决这个问题?
最佳答案
根据您的错误信息,它是一个 C++ 项目。
请查看this document ,dotnet CLI 仅支持 .NET/.NET Core/.NET Standard 项目。
C++ 项目是 Visual Studio 工具(C++ 工作负载)的一部分。 dotnet CLI 不包含 Visual C++ 编译器或必要的 Windows SDK。所以在Windows中不支持直接使用dotnet msbuild构建C++项目,更不用说CentOS了。
要在 linux 中构建 C++ 项目,您可以尝试 g++ compiler ,您可以找到许多有关如何在线使用它的相关信息。
此外,也许您可以尝试使用 GCCBuild在 Linux 中构建 vcxproj 文件。它简单地使用与 vcxproj 相同的结构,但使用 GCC 进行编译和构建。感谢 Roozbeh。
关于linux - Centos 上的 MSBuild 返回 "The imported project "/Microsoft.Cpp.Default.props“未找到”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56548787/