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

For source build on Windows we need to use the references that come from the downloaded cli #3344

Open safern opened 6 years ago

safern commented 6 years ago

Steps to reproduce

Revert PR: https://github.com/Microsoft/msbuild/pull/3340 Then go to dotnet/source-build repo. Checkout master branch and then update the src/msbuild git submodule to point to your branch that contains the reverted PR. To do this you need to push the branch to your fork and then in your source-build local repo from a command line go to src/msbuild and then run:

git remote add myfork https://github.com/<YourGHUser>/msbuild git pull myfork <branchContainingChanges>

navigate back to source-build root and then run:

build.cmd /p:RootRepo=msbuild

If you look at the restored Microsoft.NETCore.App package for the Microsoft.Build.csproj it will restore the version of the dotnet SDK that you have installed in your machine rather than using the one that comes from the downloaded CLI in source-build.

Note that in source-build we're setting DOTNET_MULTILEVEL_LOOKUP = 0 at the beginning of the execution to tell the cli to explicitly use the downloaded one.

Also, if this is the first time using the source-build repo, before doing anything else, you need to run: git submodule update --init --recursive

cc: @rainersigwald

safern commented 6 years ago

Fixed in source-build by setting env vars.

rainersigwald commented 6 years ago

Reopening because I want to take a look at this: I feel like we should set that env var internally.

safern commented 6 years ago

The env vars that I set in source-build to workaround this are: DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR = $DotNetCoreSdkDir MSBuildSDKsPath = $DotNetCoreSdkDir\sdk\$env:SDK_VERSION\Sdks

SDK_VERSION is set by source_build at the beginning of the execution. It is used across other repos.