The travis build fails, i get the same error locally
dotnet pack -c Release -o /app/artifacts -p:Version=`cat /app/tools/version` src/NoSln
Microsoft (R) Build Engine version 16.0.450+ga8dc7f1d34 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
/app/src/NoSln/NoSln.Library.fsproj : error NU1403: The package NETStandard.Library.2.0.3 sha512 validation failed. The package is different than the last restore.
Restore failed in 801.46 ms for /app/src/NoSln/NoSln.Library.fsproj.
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:
upgrade minver to fix the same issue of #2
include the fix for #2
i left the old property so dotnet nosln command is usable both in .net core sdk 2.x and 3.x
but i am back to initial issue, the example projects seems to have issues with lock, the dotnet pack was ok, but the next dotnet test was not
/usr/share/dotnet/sdk/3.0.100/NuGet.targets(123,5): error NU1004: The packages lock file is inconsistent with the project dependencies so restore can't be run in locked mode. Disable the RestoreLockedMode MSBuild property or pass an explicit --force-evaluate option to run restore to update the lock file. [/app/nosln.sln]
so i changed the build script to restore once with dotnet restore --locked-mode, and do not restore (--no-restore) in pack/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.x
By 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
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]
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
FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100
WORKDIR /app
RUN dotnet new tool-manifest
RUN dotnet tool install --local dotnet-nosln --version 0.6.1
RUN dotnet nosln --version
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 in src/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 :( )
It's invalid to use both `rollForward` and one of `rollForwardOnNoCandidateFx` or `applyPatches` in the same runtime config.
Invalid runtimeconfig.json [/app/tools/.store/dotnet-nosln/0.6.2-alpha.0.5/dotnet-nosln/0.6.2-alpha.0.5/tools/netcoreapp2.1/any/dotnet-nosln.runtimeconfig.json] [/app/tools/.store/dotnet-nosln/0.6.2-alpha.0.5/dotnet-nosln/0.6.2-alpha.0.5/tools/netcoreapp2.1/any/dotnet-nosln.runtimeconfig.dev.json]
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 https://github.com/NuGet/Home/issues/7921#issuecomment-478152479 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 #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)