Hi all, I'm working on a test project that has multiple targets netcoreapp3.1, net5.0, and net6.0.
For the targets netcoreapp3.1 and net5.0, the test project needs to reference to NuGet packages Microsoft.PowerShell.SDK version 7.0.6 (targeting 3.1) and 7.1.3 (targeting 5.0) respectively.
For the target net6.0, the test project needs to reference the library project Microsoft.PowerShell.SDK.csproj, which lives in the same repo.
So the .csproj file for the test project looks like this (see the the complete version of this file here, in my temp branch):
It looks simple, but dotnet restore fails with the following errors:
error NU1201: Project Microsoft.PowerShell.Commands.Diagnostics is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
Project Microsoft.PowerShell.Commands.Diagnostics supports: net6.0 (.NETCoreApp,Version=v6.0)
error NU1201: Project Microsoft.PowerShell.Commands.Management is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1)
Project Microsoft.PowerShell.Commands.Management supports: net6.0 (.NETCoreApp,Version=v6.0)
error NU1201: Project Microsoft.PowerShell.Commands.Utility is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
Project Microsoft.PowerShell.Commands.Utility supports: net6.0 (.NETCoreApp,Version=v6.0)
error NU1201: Project Microsoft.PowerShell.ConsoleHost is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
Project Microsoft.PowerShell.ConsoleHost supports: net6.0 (.NETCoreApp,Version=v6.0)
error NU1201: Project Microsoft.PowerShell.Security is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
Project Microsoft.PowerShell.Security supports: net6.0 (.NETCoreApp,Version=v6.0)
error NU1201: Project System.Management.Automation is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
Project System.Management.Automation supports: net6.0 (.NETCoreApp,Version=v6.0)
======= Same errors repeated for net5.0 ========
(NOTE: the projects Microsoft.PowerShell.Commands.Management, Microsoft.PowerShell.Commands.Utility, and etc are dependencies of Microsoft.PowerShell.SDK.csproj, and they are all targeting net6.0 currently)
The ProjectReference to Microsoft.PowerShell.SDK.csproj and Microsoft.PowerShell.Commands.Diagnostics.csproj are grouped in a ItemGroup with the condition "'$(TargetFramework)' == 'net6.0'", so why was dotnet restore checking compatibility for those project references with netcoreapp3.1 and net5.0? Can someone please suggest how to make this work?
Repro steps and/or sample project
The complete version of this project can be found here, in my temp branch.
Verbose Logs
Here is the ZIP package that contains binlog files from running dotnet restore /bl and dotnet build -f net6.0 -c release /bl respectively.
FYI, this is for a benchmark project. We want to run the benchmarks easily against our current code base (net6.0) and our shipped NuGet packages within their corresponding target runtimes (net5.0 or netcoreapp3.1).
Details about Problem
Problem
Hi all, I'm working on a test project that has multiple targets
netcoreapp3.1
,net5.0
, andnet6.0
.netcoreapp3.1
andnet5.0
, the test project needs to reference to NuGet packagesMicrosoft.PowerShell.SDK
version7.0.6
(targeting 3.1) and7.1.3
(targeting 5.0) respectively.net6.0
, the test project needs to reference the library projectMicrosoft.PowerShell.SDK.csproj
, which lives in the same repo.So the .csproj file for the test project looks like this (see the the complete version of this file here, in my temp branch):
It looks simple, but
dotnet restore
fails with the following errors:(NOTE: the projects
Microsoft.PowerShell.Commands.Management
,Microsoft.PowerShell.Commands.Utility
, and etc are dependencies ofMicrosoft.PowerShell.SDK.csproj
, and they are all targetingnet6.0
currently)The ProjectReference to
Microsoft.PowerShell.SDK.csproj
andMicrosoft.PowerShell.Commands.Diagnostics.csproj
are grouped in aItemGroup
with the condition"'$(TargetFramework)' == 'net6.0'"
, so why wasdotnet restore
checking compatibility for those project references with netcoreapp3.1 and net5.0? Can someone please suggest how to make this work?Repro steps and/or sample project
The complete version of this project can be found here, in my temp branch.
Verbose Logs
Here is the ZIP package that contains binlog files from running
dotnet restore /bl
anddotnet build -f net6.0 -c release /bl
respectively.binlog.zip
FYI, this is for a benchmark project. We want to run the benchmarks easily against our current code base (net6.0) and our shipped NuGet packages within their corresponding target runtimes (net5.0 or netcoreapp3.1).