Microsoft.PowerShell.5.1.ReferenceAssemblies does not allow using a version of full .Net lower than 4.6.1
Opening the issue here, as suggested by Steve here.: Given the following csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.PowerShell.5.1.ReferenceAssemblies" Version="1.0.0" />
</ItemGroup>
</Project>
Running dotnet build on it, results in a build error telling me that net461 is the lowest supported .Net version:
error NU1202: Package Microsoft.PowerShell.5.1.ReferenceAssemblies 1.0.0 is not compatible with net46 (.NETFramework,Version=v4.6). Package Microsoft.PowerShell.5.1.ReferenceAssemblies 1.0.0 supports: net461 (.NETFramework,Version=v4.6.1)
Similar to the Microsoft.PowerShell.5.ReferenceAssemblies package, I expect it to work down to at least net45 and its other minor versions like net451 or net452, etc. I am using the latest .Net SDK btw.
cc @JamesWTruher
P.S. By comparing it against the Microsoft.PowerShell.5.ReferenceAssemblies, it shows that the 5.1 package was built against net461 whereas the 5.0 package was build against net4, therefore it seems that building against net4 should solve the problem. Also: the package does not declare this dependency, if dotnet pack was being used, I am sure that this dependency would've been visible in the nuspec file and to the end user before even trying to install it.
Regarding net45, it's been out of support (https://support.microsoft.com/en-us/help/17455/lifecycle-faq-net-framework) so I don't think we should support that. It seems there is no reason we shouldn't use net46 vs net461, so I would propose a 1.0.1 release built against net46
Ok, thanks for letting me know, I did not know that. When reading your link it sounded rather that net45 and net451 are deprecated but not net452. I would propose to build against net452 then.
net452 is tied to the OS, it looks like Server 2012 R2 is out of mainstream support and only in extended support. However, that extended support goes through 2023. So it seems ok to build against net452.
Perfect :)