-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade to .net core sdk 3, fix docker/travis/win build #3
Conversation
``` dotnet nuget locals all --clear git clean -xfd git rm **/packages.lock.json -f dotnet restore ```
bump to v2 to be runnable without .net core runtime 2.1
by default the tools expect an installed .net core NET Core Runtime >= 2.1 and < 3 The .NET Core Sdk 3.x doesnt contains the runtime 2.1.x, so fails at runtime with ``` It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '2.1.0' was not found. - The following frameworks were found: 3.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] ``` This fix allow to run with any .net core >= 2.1 Scenario is `dotnet nosln` installed as local tool in .net core sdk 3.x or in a docker container based on .net core sdk 3.x
@eiriktsarpalis you can repro this locally? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
global.json
Outdated
@@ -0,0 +1,5 @@ | |||
{ | |||
"sdk": { | |||
"version": "3.0.100" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of global.json files as they are too constraining on the dev environment. Generally prefer docker as a means to enforce reproducible builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it
@eiriktsarpalis i had to add some workaround to fix the issue (i dont know nuget lock files quirks a lot), but now seems ok. It fix also #2 so i'll close it |
Thanks! |
The travis build fails, i get the same error locally
I first tried (my first commits in this PR) to fix it with the workaround in NuGet/Home#7921 (comment) but no luck
I then upgraded to .net core sdk
3.0.100
who initially fixed the error.The upgrade the base image in the dockerfile required to:
minver
to fix the same issue of fix runtime error when installed .net NET Core Runtime v3 only #2dotnet nosln
command is usable both in .net core sdk 2.x and 3.xbut i am back to initial issue, the example projects seems to have issues with lock, the
dotnet pack
was ok, but the nextdotnet test
was notso i changed the build script to restore once with
dotnet restore --locked-mode
, and do not restore (--no-restore
) inpack
/test
Not the best, but seems to work both locally, on docker and travis
fix if .net core runtime 2.x is not installed
Scenario is
dotnet nosln
installed as global/local tool with .NET Core Sdk 3.x or in a docker container based on .NET Core Sdk 3.xBy default the tool expect an installed .NET Core Runtime >= 2.1 and < 3
The .NET Core Sdk 3.x doesnt contains the runtime 2.1.x, so fails at runtime with
Because sdk and runtimes can be installed side by side, doesnt happen if the developer has a .net core sdk 2.1/2.2 installed (who bundle the 2.x runtime)
The issue can be repro'ed with the following dockerfile
This fix allow to run with any .net core runtime >= 2.1 so is compatible with any .NET Core Sdk >= 2.1
To make it work in both .net core sdk 2.x and 3.x i used
"rollForwardOnNoCandidateFx": 2
insrc/NoSln.Tool/runtimeconfig.template.json
.I tried add also the new fsproj property
<RollForward>Major</RollForward>
to be future proof, but the pack give and error if both are present (also if values are compatibile :( )so i left the old one (supported in both sdks)