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.22k stars 1.35k forks source link

New .csproj project format not recognized by xplat msbuild #1550

Closed ghost closed 7 years ago

ghost commented 7 years ago

I'm trying to build a project on the Win10 Linux subsystem, but I get the following error:

error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. 
If the project is authored in the MSBuild 2003 format, please add 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the 
project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

The project that I'm trying to build is using the new .csproj format, and it's building with no problem inside VS2017. So I think the problem is not with the project file. It seems to me that the cross platform msbuild that I'm using is not supporting the latest project structure changes. I have acquired the msbuild with the unofficial way documented here: https://github.com/Microsoft/msbuild/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild#unofficial-getting-net-core-msbuild-binaries-without-building-the-code

The version reported by ./Tools/dotnetcli/dotnet ./Tools/MSBuild.exe /version is 14.1.

Is there a way to get the latest version without building it?

rainersigwald commented 7 years ago

@tvsonar The best way to get .NET Core MSBuild now is through the dotnet CLI, which redistributes us. It's not always the very very latest but they take regular drops.

Thanks for pointing out the stale documentation. I just updated it.

ghost commented 7 years ago

Yep, I know that I can call dotnet build, but then is that calling directly msbuild? How is this dotnet-build command redirected to msbuild? From a didactic standpoint it's a lot cleaner to say that you run a .NET application on Windows by calling X.exe. If you run it on top of .NET Core, then you execute dotnet X.exe. And the same applies to msbuild.exe my.sln and dotnet msbuild.exe my.sln.

Note, in the meantime I managed to build it locally, and calling dotnet msbuild.dll my.sln works as expected. Except for the issue in https://github.com/Microsoft/msbuild/issues/1551.

For me it would make sense to add a flag to the unofficial way of getting the binaries to be able to get 14.1 and 15.xxx too.

rainersigwald commented 7 years ago

@tvsonar dotnet build is a wrapper around dotnet MSBuild.dll that provides some convenience parameters for you. There's also dotnet msbuild that is a thinner wrapper.

I recommend acquiring MSBuild through the CLI, but if you want more control you can execute dotnet sdk\1.0.0-preview4-004233\MSBuild.dll with your own arguments. The key benefit of the CLI is that it's an already-packaged-up set of all of the dependencies needed to build, including things logically layered "above" MSBuild itself, like NuGet and the Sdk.

For me it would make sense to add a flag to the unofficial way of getting the binaries to be able to get 14.1 and 15.xxx too.

I'm not sure I understand. The only use of the .NET Core 14.1 assemblies is to bootstrap this repo--why are you interested in getting them?

ghost commented 7 years ago

I was just surprised that when I followed the unofficial way of getting the binaries I got version 14.1 and not the latest version.

Thanks for the clarifications.