Skip to content

Commit

Permalink
Fix the assembly resolution build warning (#1165)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob-Hague authored Aug 30, 2023
1 parent 7cd0487 commit 004b57a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 52 deletions.
23 changes: 13 additions & 10 deletions src/Renci.SshNet.IntegrationTests/IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -25,23 +24,27 @@
<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>
</PackageReference>
</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>
2 changes: 2 additions & 0 deletions src/Renci.SshNet.IntegrationTests/ScpClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Renci.SshNet;

namespace IntegrationTests
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Renci.SshNet.IntegrationTests/SftpClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using Renci.SshNet;
using Renci.SshNet.Common;

namespace IntegrationTests
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Renci.SshNet.IntegrationTests/SshClientTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Renci.SshNet;

namespace IntegrationTests
{
/// <summary>
Expand Down
27 changes: 0 additions & 27 deletions src/Renci.SshNet.IntegrationTests/Usings.cs
Original file line number Diff line number Diff line change
@@ -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;


15 changes: 0 additions & 15 deletions src/Renci.SshNet.IntegrationTests/app.config

This file was deleted.

0 comments on commit 004b57a

Please sign in to comment.