I have a NuGet package library project that is compiling for .NET Core and .NET Framework. It is also using the new public signing.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Build">
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Label="Signing">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../Key.snk</AssemblyOriginatorKeyFile>
<PublicSign>true</PublicSign>
</PropertyGroup>
</Project>
I have an xUnit test project using which is also cross compiling to .NET Core and .NET Framework.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Build">
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Source\Foo\Foo.csproj" />
</ItemGroup>
</Project>
When I run the tests in this project, the .NET Core test run succeeds but the .NET Framework test run fails with:
System.IO.FileLoadException : Could not load file or assembly 'Foo, Version=0.0.1.0, Culture=neutral, PublicKeyToken=fc5550082a9c642c' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
How can I get them both to work?
User contributions licensed under CC BY-SA 3.0