microsoft/MSBuildLocator

Packaged .props and .targets files are invalid in MSBuild 14 and lower

TomKuhn opened this issue · 4 comments

Both files should start with

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

and not just

<Project>

If you use Microsoft.Build.dll from visual studio 2015, and try to load a csproj that has had Microsoft.Build.Locator nugetted into it, then LoadProject API will fail, complaining about a missing schema

Here's a repro using msbuild.exe

"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
msbuild some_project_referencing_microsoft_build_locator.csproj

Output:

packages\Microsoft.Build.Locator.1.0.31\build\Microsoft.Build.Locator.props(1,1): 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. [D:\zzz\dev\tools\xxxxx.csproj]

I'm not opposed to this but it doesn't seem like a high priority to support building projects that use Locator with VS prior to 2017, since the resulting output would only work with 2017/MSBuild 15+.

Come on guys is not right! This should be backward compatible.
There are a number of integration systems out there that do not have latest VS/msbuild

In my case I try to build a tool that will later be used to compile applications (because VS does no longer register MSBuild in GAC) and I cannot build the tool because the props file is not usable before msbuild 15. So we are back to egg and chicken.

https://ci.appveyor.com/project/gluck/gradle-msbuild-plugin/builds/21466162

See #57 for a proposed fix