Fix the assembly resolution build warning (#1165)

This commit is contained in:
Rob Hague
2023-08-30 14:56:49 +02:00
committed by GitHub
parent 7cd0487785
commit 004b57ae9e
6 changed files with 20 additions and 52 deletions
@@ -7,7 +7,6 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<!--
Even though we're not interested in producing XML docs for test projects, we have to enable this in order to have the .NET Compiler
Platform analyzers produce the IDE0005 (Remove unnecessary import) diagnostic.
@@ -25,7 +24,19 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="Testcontainers" Version="3.4.0" />
<!--
Testcontainers has a dependency on SSH.NET which causes build warnings during assembly resolution:
warning MSB3243: No way to resolve conflict between "Renci.SshNet, Version=2023.0.0.0, Culture=neutral
, PublicKeyToken=1cee9f8bde3db106" and "Renci.SshNet, Version=2020.0.2.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db
106". Choosing "Renci.SshNet, Version=2023.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106" arbitrarily.
To fix, we explicitly exclude the SSH.NET nuget package from this project's dependencies.
-->
<PackageReference Include="SSH.NET" Version="2020.0.2" ExcludeAssets="All"/>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
@@ -33,15 +44,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Renci.SshNet\Renci.SshNet.csproj">
<Aliases>LocalSshNet</Aliases>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Update="app.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<ProjectReference Include="..\Renci.SshNet\Renci.SshNet.csproj" />
</ItemGroup>
</Project>
@@ -1,3 +1,5 @@
using Renci.SshNet;
namespace IntegrationTests
{
/// <summary>
@@ -1,3 +1,6 @@
using Renci.SshNet;
using Renci.SshNet.Common;
namespace IntegrationTests
{
/// <summary>
@@ -1,3 +1,5 @@
using Renci.SshNet;
namespace IntegrationTests
{
/// <summary>
@@ -1,36 +1,9 @@
#pragma warning disable IDE0005
extern alias LocalSshNet;
global using System.Text;
global using Microsoft.VisualStudio.TestTools.UnitTesting;
global using IntegrationTests.TestsFixtures;
// The testcontainers library uses SSH.NET, so we have two versions of SSH.NET in the project.
// We need to explicitly choose which version we want to test.
// To avoid problems, we import all namespaces.
global using LocalSshNet::Renci.SshNet;
global using LocalSshNet::Renci.SshNet.Abstractions;
global using LocalSshNet::Renci.SshNet.Channels;
global using LocalSshNet::Renci.SshNet.Common;
global using LocalSshNet::Renci.SshNet.Compression;
global using LocalSshNet::Renci.SshNet.Connection;
global using LocalSshNet::Renci.SshNet.Messages;
global using LocalSshNet::Renci.SshNet.Messages.Authentication;
global using LocalSshNet::Renci.SshNet.Messages.Connection;
global using LocalSshNet::Renci.SshNet.Messages.Transport;
global using LocalSshNet::Renci.SshNet.NetConf;
global using LocalSshNet::Renci.SshNet.Security;
global using LocalSshNet::Renci.SshNet.Security.Chaos;
global using LocalSshNet::Renci.SshNet.Security.Chaos.NaCl;
global using LocalSshNet::Renci.SshNet.Security.Chaos.NaCl.Internal;
global using LocalSshNet::Renci.SshNet.Security.Cryptography;
global using LocalSshNet::Renci.SshNet.Security.Cryptography.Ciphers;
global using LocalSshNet::Renci.SshNet.Security.Org;
global using LocalSshNet::Renci.SshNet.Security.Org.BouncyCastle;
global using LocalSshNet::Renci.SshNet.Sftp;
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Renci.SshNet"
publicKeyToken="1cee9f8bde3db106"
culture="neutral" />
<bindingRedirect oldVersion="2020.0.2.0-2023.0.0.0" newVersion="2023.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>