Skip to content

Commit 004b57a

Browse files
authored
Fix the assembly resolution build warning (#1165)
1 parent 7cd0487 commit 004b57a

File tree

6 files changed

+20
-52
lines changed

6 files changed

+20
-52
lines changed

src/Renci.SshNet.IntegrationTests/IntegrationTests.csproj

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
<IsPackable>false</IsPackable>
99
<IsTestProject>true</IsTestProject>
10-
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
1110
<!--
1211
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
1312
Platform analyzers produce the IDE0005 (Remove unnecessary import) diagnostic.
@@ -25,23 +24,27 @@
2524
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
2625
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
2726
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
27+
2828
<PackageReference Include="Testcontainers" Version="3.4.0" />
29+
<!--
30+
Testcontainers has a dependency on SSH.NET which causes build warnings during assembly resolution:
31+
32+
warning MSB3243: No way to resolve conflict between "Renci.SshNet, Version=2023.0.0.0, Culture=neutral
33+
, PublicKeyToken=1cee9f8bde3db106" and "Renci.SshNet, Version=2020.0.2.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db
34+
106". Choosing "Renci.SshNet, Version=2023.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106" arbitrarily.
35+
36+
To fix, we explicitly exclude the SSH.NET nuget package from this project's dependencies.
37+
-->
38+
<PackageReference Include="SSH.NET" Version="2020.0.2" ExcludeAssets="All"/>
39+
2940
<PackageReference Include="coverlet.collector" Version="6.0.0">
3041
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3142
<PrivateAssets>all</PrivateAssets>
3243
</PackageReference>
3344
</ItemGroup>
3445

3546
<ItemGroup>
36-
<ProjectReference Include="..\Renci.SshNet\Renci.SshNet.csproj">
37-
<Aliases>LocalSshNet</Aliases>
38-
</ProjectReference>
39-
</ItemGroup>
40-
41-
<ItemGroup>
42-
<None Update="app.config">
43-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
44-
</None>
47+
<ProjectReference Include="..\Renci.SshNet\Renci.SshNet.csproj" />
4548
</ItemGroup>
4649

4750
</Project>

src/Renci.SshNet.IntegrationTests/ScpClientTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Renci.SshNet;
2+
13
namespace IntegrationTests
24
{
35
/// <summary>

src/Renci.SshNet.IntegrationTests/SftpClientTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
using Renci.SshNet;
2+
using Renci.SshNet.Common;
3+
14
namespace IntegrationTests
25
{
36
/// <summary>

src/Renci.SshNet.IntegrationTests/SshClientTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Renci.SshNet;
2+
13
namespace IntegrationTests
24
{
35
/// <summary>
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,9 @@
11
#pragma warning disable IDE0005
22

3-
extern alias LocalSshNet;
4-
53
global using System.Text;
64

75
global using Microsoft.VisualStudio.TestTools.UnitTesting;
86

97
global using IntegrationTests.TestsFixtures;
108

11-
// The testcontainers library uses SSH.NET, so we have two versions of SSH.NET in the project.
12-
// We need to explicitly choose which version we want to test.
13-
// To avoid problems, we import all namespaces.
14-
global using LocalSshNet::Renci.SshNet;
15-
global using LocalSshNet::Renci.SshNet.Abstractions;
16-
global using LocalSshNet::Renci.SshNet.Channels;
17-
global using LocalSshNet::Renci.SshNet.Common;
18-
global using LocalSshNet::Renci.SshNet.Compression;
19-
global using LocalSshNet::Renci.SshNet.Connection;
20-
global using LocalSshNet::Renci.SshNet.Messages;
21-
global using LocalSshNet::Renci.SshNet.Messages.Authentication;
22-
global using LocalSshNet::Renci.SshNet.Messages.Connection;
23-
global using LocalSshNet::Renci.SshNet.Messages.Transport;
24-
global using LocalSshNet::Renci.SshNet.NetConf;
25-
global using LocalSshNet::Renci.SshNet.Security;
26-
global using LocalSshNet::Renci.SshNet.Security.Chaos;
27-
global using LocalSshNet::Renci.SshNet.Security.Chaos.NaCl;
28-
global using LocalSshNet::Renci.SshNet.Security.Chaos.NaCl.Internal;
29-
global using LocalSshNet::Renci.SshNet.Security.Cryptography;
30-
global using LocalSshNet::Renci.SshNet.Security.Cryptography.Ciphers;
31-
global using LocalSshNet::Renci.SshNet.Security.Org;
32-
global using LocalSshNet::Renci.SshNet.Security.Org.BouncyCastle;
33-
34-
global using LocalSshNet::Renci.SshNet.Sftp;
35-
369

src/Renci.SshNet.IntegrationTests/app.config

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)