MSBuild on Centos returns “The imported project ”/Microsoft.Cpp.Default.props“ was not found”

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 11:41:06

问题


I'm trying to build a VS project in CentOS. I installed dotnet-sdk-2.2 via yum install dotnet-sdk-2.2.

When executing dotnet msbuild myproj.vcxproj I get:

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.

Googling results with many solutions but for Windows. what can I do to resolve this over Linux/CentOS?


回答1:


According to your error message it's a C++ project.

Please check this document,the dotnet CLI only supports .NET / .NET Core / .NET Standard projects.

C++ projects are part of the visual studio tooling (c++ workload). The dotnet CLI doesn't contain the visual c++ compiler or the necessary windows SDKs. So it's not supported to build C++ projects directly using dotnet msbuild in Windows, not to speak of CentOS.

To build C++ projects in linux, you can try g++ compiler, you can find many related info about how to use it online.

Also, maybe you can try using GCCBuild to build vcxproj files in Linux. It simple uses same structure of vcxproj but uses GCC to compile and build. Thanks to Roozbeh.



来源:https://stackoverflow.com/questions/56548787/msbuild-on-centos-returns-the-imported-project-microsoft-cpp-default-props-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!