PowerShell/PowerShellStandard

Cannot reference PowerShellStandard from unit tests

lzybkr opened this issue · 1 comments

It is difficult to reference PowerShellStandard from xunit/mstest style unit tests in a project targeting net46.

A reference assembly with empty implementations (returning null or default(T)) is placed alongside the unit test binaries.

I've worked around this by using Microsoft.PowerShell.5.ReferenceAssemblies, but that is not ideal.

Have you tried using the private assets option. i.e.

<ItemGroup>
    <PackageReference Include="PowerShellStandard.Library" Version="5.1.0" PrivateAssets="All" />
</ItemGroup>

See Controlling dependency assets