msbuild: Unable to compile msbuild from source on linux

Steps to reproduce

Following instructions from https://github.com/Microsoft/msbuild/blob/master/documentation/wiki/Building-Testing-and-Debugging-on-Mono-MSBuild.md:

  1. clone msbuild repo
  2. check out xplat-master
  3. recursive submodule init update (nothing happened)
  4. ensure mono is in PATH and call ‘make’: ~/Projects/msbuild$ PATH=~/.mono/bin:$PATH make

Expected behavior

A working msbuild.exe

Actual behavior

Build started 2/22/2019 1:53:13 PM.
/home/kate/Projects/msbuild/artifacts/toolset/restore.proj : error : Unable to load the service index for source https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json.
/home/kate/Projects/msbuild/artifacts/toolset/restore.proj : error MSB4236: The SDK 'RoslynTools.RepoToolset' specified could not be found.

Build FAILED.

/home/kate/Projects/msbuild/artifacts/toolset/restore.proj : error : Unable to load the service index for source https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json.
/home/kate/Projects/msbuild/artifacts/toolset/restore.proj : error MSB4236: The SDK 'RoslynTools.RepoToolset' specified could not be found.

Time Elapsed 00:00:00.75

Environment data

msbuild /version output: n/a, I don’t have a msbuild.exe

OS info: debian 9 x64

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc): mono built from source (latest master as of a couple days ago)

I checked my NuGet.config in ~/ and the one in the repo root and they both look okay. I don’t have a proxy.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 38 (25 by maintainers)

Most upvoted comments

For an update, on latest xplat-master the process we’re currently using to build on ubuntu-based continuous integration is roughly the following:

# in mono/
./autogen.sh --prefix=/mono-prefix/
make
make install
export PATH=/mono-prefix/bin:$PATH
cert-sync /etc/ssl/certs/ca-certificates.crt # this is only necessary the first time you build at the prefix. without it you will have no SSL certs = nuget won't work
# in msbuild:xplat-master/
./eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release /p:DisableNerdbankVersioning=true "/p:Projects=./src/MSBuild.Bootstrap/MSBuild.Bootstrap.csproj" /p:AssemblyVersion=15.1.0.0

If anyone trying to build on linux can’t successfully build using these steps, please let me know.

Current status: Do not consider this blessed advice, but I was able to compile an msbuild.dll without any compile errors or script errors via this approach: PATH=~/.mono/bin:$PATH eng/cibuild_bootstrapped_msbuild.sh --host_type mono --configuration Release --binaryLog --skip_tests /p:DisableNerdbankVersioning=true "/p:Projects=`pwd`/src/MSBuild/MSBuild.csproj" /p:AssemblyVersion=15.1.0.0

The p:Projects disables building of the test assemblies (since they’re broken), the assemblyversion works around some binding redirect problems, and disabling nerdbank works around libgit/libssl issues.

I am not totally certain the resulting msbuild works right, though.

I have also observed the ThisAssembly error, but it’s an error in automated tests. If you examine your artifacts folder, you should have a MsBuild.dll that you can run as an executable (using mono or dotnet). Give that a try