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

Tests that copy msbuild.exe fail on xplat netcore #1112

Closed rainersigwald closed 8 years ago

rainersigwald commented 8 years ago

Switching to the dotnet CLI host for tests (#932) causes some tests to fail:

These tests have in common that they involve copying msbuild.exe into another folder and running it from there.

Output of failing tests ``` console $ /Users/raines/src/msbuild/Tools/dotnetcli/dotnet /Users/raines/src/msbuild/bin/Debug-NetCore/OSX_Deployment_Test/xunit.console.netcore.exe /Users/raines/src/msbuild/bin/Debug-NetCore/OSX_Deployment_Test/Microsoft.Build.CommandLine.UnitTests.dll -method Microsoft.Build.UnitTests.XMakeAppTests.ResponseFileInProjectDirectoryWinsOverMainMSBuildRsp -method Microsoft.Build.UnitTests.XMakeAppTests.ProjectDirectoryIsMSBuildExeDirectory xUnit.net console test runner (64-bit .NET Core) Copyright (C) 2014 Outercurve Foundation. Discovering: Microsoft.Build.CommandLine.UnitTests Discovered: Microsoft.Build.CommandLine.UnitTests Starting: Microsoft.Build.CommandLine.UnitTests Executing [/Users/raines/src/msbuild/Tools/dotnetcli/dotnet "/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/d5960e2212934764b3a1cc856f91288e/msbuild.exe" "/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/2cbcdd3b95ad463183b67f346f0817d7/my.proj"] ==== OUTPUT ==== A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/private/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/d5960e2212934764b3a1cc856f91288e'. ============== Microsoft.Build.UnitTests.XMakeAppTests.ResponseFileInProjectDirectoryWinsOverMainMSBuildRsp [FAIL] Assert.True() Failure Expected: True Actual: False Stack Trace: src/XMakeCommandLine/UnitTests/XMake_Tests.cs(1026,0): at Microsoft.Build.UnitTests.XMakeAppTests.ResponseFileInProjectDirectoryWinsOverMainMSBuildRsp() Executing [/Users/raines/src/msbuild/Tools/dotnetcli/dotnet "/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/f8a17b6627f74bf38f42ba129d5c18a1/msbuild.exe" "/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/f8a17b6627f74bf38f42ba129d5c18a1/my.proj"] ==== OUTPUT ==== A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/private/var/folders/lh/m1h2nk097kzc5k8tlwhbf2kw0000gn/T/f8a17b6627f74bf38f42ba129d5c18a1'. ============== Microsoft.Build.UnitTests.XMakeAppTests.ProjectDirectoryIsMSBuildExeDirectory [FAIL] Assert.True() Failure Expected: True Actual: False Stack Trace: src/XMakeCommandLine/UnitTests/XMake_Tests.cs(1062,0): at Microsoft.Build.UnitTests.XMakeAppTests.ProjectDirectoryIsMSBuildExeDirectory() Finished: Microsoft.Build.CommandLine.UnitTests === TEST EXECUTION SUMMARY === Microsoft.Build.CommandLine.UnitTests Total: 2, Errors: 0, Failed: 2, Skipped: 0, Time: 1.045s ```

The error is

The library 'libhostpolicy.dylib' required to execute the application was not found

I believe this is because the CLI expects a deps.json next to the application it's running with information about how to find required libraries (that particular one is from runtime.osx.10.10-x64.Microsoft.NETCore.DotNetHostPolicy).

rainersigwald commented 8 years ago

@jeffkl does that theory sound reasonable? You're working on causing us to build a deps.json, right?

jeffkl commented 8 years ago

Yes our MSBuild.deps.json is missing and our MSBuild.runtimeconfig.json is copied out of the BuildTools package. My change will use a task library that generates these two files which should fix the issue described here.