Description
Fixie.Console 2.2.1 targets netcoreapp3.1
:
However, if the only .NET Core SDK installed is a later one (e.g. 5.0), then running tests in a project which references it like this fails:
<DotNetCliToolReference Include="Fixie.Console" Version="2.2.1" />
(Note: this might be caused by a Fixie.Console transitive dependency)
Steps to Reproduce
This commit nil4/dotnet-transform-xdt@9cab0ad updates the SDK to 5.0. The GitHub actions build failed with the following message:
dotnet fixie --configuration Release --report test-results.xml
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
- The following frameworks were found:
5.0.0 at [C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\shared\Microsoft.NETCore.App]
This reproduces locally with this dotnet --info
output:
dotnet --info
>dotnet --info .NET SDK (reflecting any global.json): Version: 5.0.100 Commit: 5044b93829
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7.NET SDKs installed:
5.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Expected Behavior
dotnet fixie
works when only a later .NET SDK (e.g. 5.0) is installed.
Actual Behavior
dotnet fixie
fails when 'Microsoft.NETCore.App', version '2.0.0' is not available.
More information
In the local NuGet cache folder, I updated dotnet-fixie.runtimeconfig.json
with the following:
{
"runtimeOptions": {
"tfm": "netcoreapp2.0",
+ "rollForward": "Major",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "2.0.0"
}
}
}
This runtime option is documented here: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#runtimesdk
With this change, the issue appears resolved. The output is below, for reference:
dotnet fixie --configuration Release --report test-results.xml Building dotnet-xdt.tests... dotnet-xdt -> D:\projects\dotnet-xdt\dotnet-xdt\bin\Release\net461\dotnet-xdt.exe dotnet-xdt -> D:\projects\dotnet-xdt\dotnet-xdt\bin\Release\netcoreapp2.1\dotnet-xdt.dll dotnet-xdt.tests -> D:\projects\dotnet-xdt\dotnet-xdt.tests\bin\Release\netcoreapp3.1\dotnet-xdt.tests.dll dotnet-xdt.tests -> D:\projects\dotnet-xdt\dotnet-xdt.tests\bin\Release\net48\dotnet-xdt.tests.dll dotnet-xdt.tests -> D:\projects\dotnet-xdt\dotnet-xdt.tests\bin\Release\net5.0\dotnet-xdt.tests.dll Running dotnet-xdt.tests (net5.0)
5 passed, took 0.15 seconds
Running dotnet-xdt.tests (netcoreapp3.1)
5 passed, took 0.15 seconds
Running dotnet-xdt.tests (net48)
5 passed, took 0.15 seconds
Would you be possible to add the <RollForward>Major</RollForward>
to the Fixie.Console project?
See nil4/dotnet-transform-xdt#42 for a change that helped a similar use case.