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

Solution build fails with zero errors #1767

Closed natemcmaster closed 6 years ago

natemcmaster commented 7 years ago

Build a solution can cause MSBuild to succeed on all projects build still fail. When it fails, it shows zero errors and no additional information about what went wrong.

Repro:

https://github.com/aspnet/JavaScriptServices/tree/d8128ee3dcb687a854ee509d62d255c1eba48723

dotnet restore JavaScriptServices.sln dotnet build JavaScriptServices.sln

Output

dotnet build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft.AspNetCore.NodeServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.NodeServices\bin\Debug\net451\Microsoft.AspNetCore.NodeServices.dll
  Microsoft.AspNetCore.NodeServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.NodeServices\bin\Debug\netstandard1.6\Microsoft.AspNetCore.NodeServices.dll
  Microsoft.AspNetCore.SpaServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.SpaServices\bin\Debug\net451\Microsoft.AspNetCore.SpaServices.dll
  KnockoutSpa -> C:\dev\Universe\JavaScriptServices\templates\KnockoutSpa\bin\Debug\netcoreapp1.1\KnockoutSpa.dll
  ReactSpa -> C:\dev\Universe\JavaScriptServices\templates\ReactSpa\bin\Debug\netcoreapp1.1\ReactSpa.dll
  AureliaSpa -> C:\dev\Universe\JavaScriptServices\templates\AureliaSpa\bin\Debug\netcoreapp1.1\AureliaSpa.dll
  Angular2Spa -> C:\dev\Universe\JavaScriptServices\templates\Angular2Spa\bin\Debug\netcoreapp1.1\Angular2Spa.dll
  WebApplicationBasic -> C:\dev\Universe\JavaScriptServices\templates\WebApplicationBasic\bin\Debug\netcoreapp1.1\WebApplicationBasic.dll
  ReactReduxSpa -> C:\dev\Universe\JavaScriptServices\templates\ReactReduxSpa\bin\Debug\netcoreapp1.1\ReactReduxSpa.dll
  Microsoft.AspNetCore.NodeServices.Sockets -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.NodeServices.Sockets\bin\Debug\net451\Microsoft.AspNetCore.NodeServices.Sockets.dll
  NodeServicesExamples -> C:\dev\Universe\JavaScriptServices\samples\misc\NodeServicesExamples\bin\Debug\netcoreapp1.1\NodeServicesExamples.dll
  Microsoft.AspNetCore.SpaServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.SpaServices\bin\Debug\netstandard1.6\Microsoft.AspNetCore.SpaServices.dll
  Microsoft.AspNetCore.NodeServices.Sockets -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.NodeServices.Sockets\bin\Debug\netstandard1.6\Microsoft.AspNetCore.NodeServices.Sockets.dll
  Microsoft.AspNetCore.AngularServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.AngularServices\bin\Debug\net451\Microsoft.AspNetCore.AngularServices.dll
  Microsoft.AspNetCore.ReactServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.ReactServices\bin\Debug\net451\Microsoft.AspNetCore.ReactServices.dll
  LatencyTest -> C:\dev\Universe\JavaScriptServices\samples\misc\LatencyTest\bin\Debug\netcoreapp1.1\LatencyTest.dll
  Microsoft.AspNetCore.ReactServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.ReactServices\bin\Debug\netstandard1.6\Microsoft.AspNetCore.ReactServices.dll
  Microsoft.AspNetCore.AngularServices -> C:\dev\Universe\JavaScriptServices\src\Microsoft.AspNetCore.AngularServices\bin\Debug\netstandard1.6\Microsoft.AspNetCore.AngularServices.dll
  ReactGrid -> C:\dev\Universe\JavaScriptServices\samples\react\ReactGrid\bin\Debug\netcoreapp1.1\ReactGrid.dll
  MusicStore -> C:\dev\Universe\JavaScriptServices\samples\react\MusicStore\bin\Debug\netcoreapp1.1\MusicStore.dll
  MusicStore -> C:\dev\Universe\JavaScriptServices\samples\angular\MusicStore\bin\Debug\netcoreapp1.1\MusicStore.dll
Controllers\FullPagePrerenderingController.cs(16,13): warning CS0618: 'JavaScriptModuleExport.WebpackConfig' is obsolete: 'Do not use. This feature will be removed. Instead, configure Webpack to build a Node.js-compatible bundle and reference that directly.' [C:\dev\Universe\JavaScriptServices\samples\misc\Webpack\Webpack.csproj]
  Webpack -> C:\dev\Universe\JavaScriptServices\samples\misc\Webpack\bin\Debug\netcoreapp1.1\Webpack.dll

Build FAILED.

Controllers\FullPagePrerenderingController.cs(16,13): warning CS0618: 'JavaScriptModuleExport.WebpackConfig' is obsolete: 'Do not use. This feature will be removed. Instead, configure Webpack to build a Node.js-compatible bundle and reference that directly.' [C:\dev\Universe\JavaScriptServices\samples\misc\Webpack\Webpack.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:07.24

Returns with error code 1.

The warning does not cause the build to fail. Disabling this CSC warning and recompiling the solution still causes the same zero-error failure.

Increasing verbosity does not show additional information about what failed.

Details dotnet.exe: 1.0.0-rc4-004911 Does not happen in MSBuild.exe

cc @SteveSandersonMS

Eilon commented 7 years ago

BTW we suspect that this is broken because the SLN contains Web Site Projects, and that dotnet build gets confused with it, but of course msbuild.exe has no problem with it.

SteveSandersonMS commented 7 years ago

Glad to have helped find an edge case :)

@Eilon, @natemcmaster The Web Site Projects are an unfortunate throwback, only there because it doesn't seem there's any modern alternative. But TBH we can just remove them from the .sln to unblock ourselves - it's perfectly fine to be using VS Code for all the non-.NET projects.

Eilon commented 7 years ago

@SteveSandersonMS if you're OK with that, that's fine with me. An alternative that @natemcmaster suggested was to just build the csproj's by globbing for them, and thus avoid building the SLN until this issue is resolved.

rainersigwald commented 7 years ago

Web Site Projects sounds entirely plausible as a reason. They are treated specially and I bet we didn't have any test coverage on them when porting to Core. Of course, even if we don't support them in .NET Core MSBuild we should at least have an error.

natemcmaster commented 7 years ago

I can confirm it's the Web Sites Projects that are causing the issue. After removing them the solution builds fine.

Eilon commented 7 years ago

@rainersigwald yeah at the very least there should be an error stating that there's some unknown entries in the SLN. I don't think I'd expect dotnet build to actually support building Web Site Projects because that's a whole world unto itself. Or, at least, that would have to be a new feature request and treated independently of this issue.

danmoseley commented 7 years ago

There was test coverage of them in the "trun suites" that MSBuild used to have, but not much in the unit tests. I believe the "trun suite" coverage was not ported to github.

Rychu-Pawel commented 6 years ago

The easiest fix is to just remove the website project from build configuration of solution file.

image

natemcmaster commented 6 years ago

This is stale and we found a solution for my problem anyways.