Open KirillOsenkov opened 5 years ago
@jaredpar @tmat isn't arcade supposed to install its own CLI from the commandline? I thought this would only happen in you built from within VS?
@jmarolf
Yes / no. Up until now we've had no way to know if this setting was or was not set. I asked before but didn't get a solid answer. Hence we haev no way of knowing if the VS build will or won't work.
@KirillOsenkov
Setting that checkbox is a prerequisite for building Roslyn and it is incredibly hard to figure out why Roslyn failed to build from the symptom.
Understood. I've hit the same problem as well. It's not a decision we made though, it's a limitation we have to work with.
The checkbox to allow prerelease SDKs actually sets the contents of %localappdata%\Microsoft\VisualStudio\16.0_1b19bc0d\sdk.txt settings file to either: UsePreviews=true or UsePreviews=false.
We can try and read that to give an message. But it's more work to figure out the ID we're using (not always obvious) to construct the string for the check.
We should either print a warning
As always I want our build to be simple. But with the SDK it's often outside our control. Have to adapt.
Agreed, this is a really bad experience today.
@dotnet/msbuild What steps are necessary to force-override the setting in sdk.txt from a command line build?
if you put global.json with a 3.0.100-preview sdk version, then VS can load it without the checkbox being set. There are other consequences to global.json though. (Note: roslyn has a global.json, but not the field that actually pins the sdk, only the one that tells arcade which one to acquire.) Pinning is often not what you want, though, you really want a min version. We're adding that to global.json. We are also working out a plan for better diagnostics. It turns out to be harder than expected, but we do agree that this is painful and it is a priority to improve it. Thank you for the feedback.
One thing this demonstrated that we have missed in other feedback is the distinction between the failure in the (for lack of a better term) "arcade" case. There you have set a private preview on PATH and DOTNET_MULTILEVEL_LOOKUP=0, so the preview SDK on PATH is the only candidate. In that case, it will be easy to have a better error message and this is a simple bug fix, so we'll do that. The common case where UsePreviews=false finds an RTM SDK (by design), then the error comes from that RTM SDK saying "hey what's this netcoreapp3.0 from the future".
In addition to min-version-not-pinning in global.json, we have committed to adding a setting to enable previews in global.json. This would override the checkbox directly for any build of the repo.
In addition to min-version-not-pinning in global.json
Will we be able to use this in Arcade and remove our custom "dotnet"
entry? Is there a proposal with syntax?
As far as I saw with global.json this no longer seems to be a problem? Shall we close this?
If this is no longer necessary, we might also need to update the contributor instructions:
No I think I was wrong yesterday, this still seems to be required when the restore script wants to build Arcade’s tools.proj which doesn’t have a global.json.
Open Visual Studio 2019, Tools -> Options -> Projects and Solutions -> .NET Core and uncheck Use Previews of the .NET Core SDKs:
(in 8.1 this will be in Tools -> Options -> Environment -> Preview Features)
Then git clone https://github.com/dotnet/roslyn and run
build.cmd -restore
. It will fail with "Unable to find .NET Core SDK".The checkbox to allow prerelease SDKs actually sets the contents of
%localappdata%\Microsoft\VisualStudio\16.0_1b19bc0d\sdk.txt
settings file to either:UsePreviews=true
orUsePreviews=false
. (The1b19bc0d
part of the file path is your Visual Studio installation instance Id).This code in the .NET Core SDK Resolver reads this flag: https://github.com/dotnet/cli/blob/bfffcb23ba270640b355e729f36b34c04fad0121/src/Microsoft.DotNet.MSBuildSdkResolver/VSSettings.cs#L55-L60
Setting that checkbox is a prerequisite for building Roslyn and it is incredibly hard to figure out why Roslyn failed to build from the symptom.
We should either print a warning, or read that file and print a warning if it's not found or is set to false. Or maybe just write the file as part of installing the 3.0 SDK. The difficulty is in finding the VS instance id, but vswhere can provide that.