dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.24k stars 1.35k forks source link

[Documentation Bug]: Please clarify the relationship of this project to C/C++ #9788

Open mcclure opened 8 months ago

mcclure commented 8 months ago

Issue Description

I have a C# project (csproj) with a C/C++ project as a dependency (vcxproj): the vcxproj builds a shared object file which the csproj makes use of via p/invoke. I set this up in Visual Studio 2022 on Windows, where I find that invoking "msbuild" builds the entire project including the C parts. I eventually will want the project to also work on Linux and Mac; however, when I check out my project and run dotnet build, I get an unhelpful error message about "/Microsoft.Cpp.Default.props" not being found. (I have been told a recent PR improves this to a helpful error message.) None of this is the problem.

The problem is that during the above experience, I find myself wondering the following reasonable questions:

And I do not find these questions answered either in the README or in any of the pages I checked linked from the README.

Steps to Reproduce

"Open https://github.com/dotnet/msbuild in a web browser and read it"

Expected Behavior

It's hard for me to give a specific suggestion because I don't know which of the following realities we live in:

  1. The open source msbuild can build C#, but not C++.
  2. The open source msbuild can build C# on all platforms, and C++ only on Windows.
  3. msbuild is an abstract system that executes xml build scripts; to "build" a computer program, you usually must combine it with components implementing support for specific compilers. There happens to be an open source component for C#/.NET which ships packaged with msbuild as part of "dotnet"; whereas building projects in the common .vcxproj format requires proprietary components that ship with Visual Studio.

I think whichever of the above realities we live in should be explained in two places:

Actual Behavior

It's vague

Analysis

No response

Versions & Configurations

README version 42383a8

Aero9999 commented 3 months ago

As per https://github.com/dotnet/sdk/issues/10239

The 'dotnet' command does not support building C++ projects (vcxproj)

More specifically, the version of msbuild that comes with dotnet can't. You'll need to use the full fledged MSBuild that ships with Visual Studio.