Bug 57901 - Building/restoring .NET Core project with MSBuild results in System.DllNotFoundException: hostfxr
Summary: Building/restoring .NET Core project with MSBuild results in System.DllNotFou...
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: 5.2 (2017-04)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Jo Shields
URL:
Depends on:
Blocks:
 
Reported: 2017-07-02 07:15 UTC by Connie
Modified: 2017-07-12 21:06 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Connie 2017-07-02 07:15:23 UTC
I am trying to compile a .NET Core solution using Mono

OS: Ubuntu 16.04
Mono Version: 5.2.0 Preview 2 (5.2.0.179) - Beta

Repro Steps:
1. Install Mono (Beta)
2. Install .NET Core (https://www.microsoft.com/net/core#linuxubuntu)
3. sudo apt-get install tzdata  (I had to do this because I had a FileNotFoundException for /etc/localtime.)
4. mkdir hello
5. cd hello
6. dotnet new library
7. msbuild /t:restore hello.csproj
8. msbuild hello.csproj

Expected: 
It builds hello.dll.

Actual:

/root/hello/hello.csproj : error MSB4014: The build stopped unexpectedly because of an internal failure.
/root/hello/hello.csproj : error MSB4014: System.DllNotFoundException: hostfxr
/root/hello/hello.csproj : error MSB4014:   at (wrapper managed-to-native) Microsoft.DotNet.MSBuildSdkResolver.Interop:u
nix_hostfxr_resolve_sdk (string,string,System.Text.StringBuilder,int)
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.Interop.hostfxr_resolve_sdk (System.S
tring exe_dir, System.String working_dir, System.Text.StringBuilder buffer, System.Int32 buffer_size) [0x00008] in <3faf
79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.Interop.hostfxr_resolve_sdk (System.S
tring exe_dir, System.String working_dir) [0x00015] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.ResolveNetco
reSdkDirectory (Microsoft.Build.Framework.SdkResolverContext context) [0x0002a] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.Resolve (Mic
rosoft.Build.Framework.SdkReference sdkReference, Microsoft.Build.Framework.SdkResolverContext context, Microsoft.Build.
Framework.SdkResultFactory factory) [0x00020] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.Build.BackEnd.SdkResolution.GetSdkPath (Microsoft.Build.Framewo
rk.SdkReference sdk, Microsoft.Build.BackEnd.Logging.ILoggingService logger, Microsoft.Build.Framework.BuildEventContext
 buildEventContext, Microsoft.Build.Construction.ElementLocation sdkReferenceLocation, System.String solutionPath, Syste
m.String projectPath) [0x0007b] in <a41b30d6352847d9bf303b0f082a0cdc>:0
/root/hello/hello.csproj : error MSB4014: The build stopped unexpectedly because of an internal failure.
/root/hello/hello.csproj : error MSB4014: System.DllNotFoundException: hostfxr
/root/hello/hello.csproj : error MSB4014:   at (wrapper managed-to-native) Microsoft.DotNet.MSBuildSdkResolver.Interop:u
nix_hostfxr_resolve_sdk (string,string,System.Text.StringBuilder,int)
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.Interop.hostfxr_resolve_sdk (System.S
tring exe_dir, System.String working_dir, System.Text.StringBuilder buffer, System.Int32 buffer_size) [0x00008] in <3faf
79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.Interop.hostfxr_resolve_sdk (System.S
tring exe_dir, System.String working_dir) [0x00015] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.ResolveNetco
reSdkDirectory (Microsoft.Build.Framework.SdkResolverContext context) [0x0002a] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.Resolve (Mic
rosoft.Build.Framework.SdkReference sdkReference, Microsoft.Build.Framework.SdkResolverContext context, Microsoft.Build.
Framework.SdkResultFactory factory) [0x00020] in <3faf79ce404840b3a95ccad4d02800ae>:0
/root/hello/hello.csproj : error MSB4014:   at Microsoft.Build.BackEnd.SdkResolution.GetSdkPath (Microsoft.Build.Framewo
rk.SdkReference sdk, Microsoft.Build.BackEnd.Logging.ILoggingService logger, Microsoft.Build.Framework.BuildEventContext  buildEventContext, Microsoft.Build.Construction.ElementLocation sdkReferenceLocation, System.String solutionPath, System.String projectPath) [0x0007b] in <a41b30d6352847d9bf303b0f082a0cdc>:0


    0 Warning(s)
    6 Error(s)

Time Elapsed 00:00:04.07
root@d3e6c1b70514:~/hello#
Comment 1 Jo Shields 2017-07-12 21:06:35 UTC
Fixed in Monday's beta push