Skip to content

Add .NET 9 target - #1480

Merged
Rob-Hague merged 17 commits into
sshnet:developfrom
mus65:net9
Nov 23, 2024
Merged

Add .NET 9 target#1480
Rob-Hague merged 17 commits into
sshnet:developfrom
mus65:net9

Conversation

@mus65

Copy link
Copy Markdown
Contributor

I had to disable a SonarSource analyzer and made use of the new Lock type, see separate Commits.

CI is expected to fail because of missing .NET 9 binaries in AppVeyor. Build and tests pass locally.

Can be merged when .NET 9 final is released and AppVeyor supports it.

@Rob-Hague

Copy link
Copy Markdown
Collaborator

Can we have a basic Lock polyfill to save on the #ifdefs? e.g.

#if !NET9_0_OR_GREATERnamespaceRenci.SshNet.Common;internalsealedclassLock{publicboolTryEnter()=>Monitor.TryEnter(this);publicvoidExit()=>Monitor.Exit(this);}

@mus65

Copy link
Copy Markdown
ContributorAuthor

Makes sense, pushed.

@drieseng

Copy link
Copy Markdown
Member

@mus65, you'll also want to update global.json.

Comment thread.editorconfig
Comment threadappveyor.yml Outdated
Comment threadtest/Renci.SshNet.Benchmarks/Renci.SshNet.Benchmarks.csproj
Comment threadtest/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj Outdated
@drieseng

Copy link
Copy Markdown
Member

@Rob-Hague, are planning on merging this before the release of .NET 9.0? In theory, there may even be API changes - I'm thinking of the Lock class - between now and the release. It's highly unlikely though.

@mus65

Copy link
Copy Markdown
ContributorAuthor

@drieseng@Rob-Hague I updated global.json . I had to reference RC1 explicitly though, so I have to change it when final is released.

I left it a draft because it's still preview and wouldn't expect it to be merged before .NET 9 final. RC1 is already released, so I wouldn't expect any more API changes.

@Rob-Hague

Copy link
Copy Markdown
Collaborator

Yeah, we will merge once .NET 9 is released

Newer targets can be used on appveyor with apt-get, as in the opposite of #1352

Co-authored-by: Rob Hague <rob.hague00@gmail.com>
for some reason this happens starting with .NET 9.0 RC2:
/home/mus/git/SSH.NET/test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj : error NU1605:
Warning As Error: Detected package downgrade: BouncyCastle.Cryptography from 2.4.0 to 2.3.1. Reference the package directly from the project to select a different version.
Renci.SshNet.IntegrationTests -> SSH.NET 1.0.0 -> BouncyCastle.Cryptography (>= 2.4.0)
Renci.SshNet.IntegrationTests -> Testcontainers 3.10.0 -> BouncyCastle.Cryptography (>= 2.3.1)
@mus65

Copy link
Copy Markdown
ContributorAuthor

This is now only blocked by AppVeyor not supporting .NET 9. apt-get is not going work either because the dotnet9 package is not available in Ubuntu 22.04 (see https://launchpad.net/ubuntu/+source/dotnet9 ).

@Rob-Hague has there been any thought about moving to GitHub actions?

@Rob-Hague

Copy link
Copy Markdown
Collaborator

I seem to remember @WojciechNagorski trying it but I can't find a PR so may be imagining

@Rob-Hague

Copy link
Copy Markdown
Collaborator

Feel free to give a go though

This was referenced Aug 12, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@mus65@Rob-Hague@drieseng