PowerShellStandard icon indicating copy to clipboard operation
PowerShellStandard copied to clipboard

Cannot reference PowerShellStandard from unit tests

Open lzybkr opened this issue 7 years ago • 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.

lzybkr avatar Jul 11 '18 18:07 lzybkr

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

BernieWhite avatar Dec 31 '18 03:12 BernieWhite