Skip to content

Use System.Security.Cryptography.Cng only with netstandard2.0 - #20

Closed
tinohager wants to merge 1 commit into
darinkes:mainfrom
tinohager:main
Closed

Use System.Security.Cryptography.Cng only with netstandard2.0#20
tinohager wants to merge 1 commit into
darinkes:mainfrom
tinohager:main

Conversation

@tinohager

Copy link
Copy Markdown
Contributor

If I understand correctly, we only need “System.Security.Cryptography.Cng” for .netstandard2.0. Perhaps we can define the dependency so that it only comes into play in that case.


<PackageReference Include="SSH.NET" Version="[2024.2.0,)" />
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.0"/>
<PackageReference Include="SSH.NET" Version="2025.0.0" />

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should stay in the minimal required format.

<PropertyGroup>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netstandard2.0</TargetFrameworks>
<TargetFramework Condition="'$(OS)' != 'Windows_NT'">netstandard2.0</TargetFramework>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netstandard2.0;net8</TargetFrameworks>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be adjusted to match SSH.NET:

<TargetFrameworks>net462;netstandard2.0;net8.0;net9.0</TargetFrameworks>

<ItemGroup Condition=" '$(TargetFramework)' != 'net48' ">
<PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSH.NET uses this, should work here too, right?

  <ItemGroup Condition=" !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) ">
    <PackageReference Include="System.Formats.Asn1" />
  </ItemGroup>

<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netstandard2.0</TargetFrameworks>
<TargetFramework Condition="'$(OS)' != 'Windows_NT'">netstandard2.0</TargetFramework>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netstandard2.0;net8</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard2.0;net8</TargetFrameworks>

@darinkes darinkes Sep 9, 2025

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, except net48

@darinkes

Copy link
Copy Markdown
Owner

Thanks for this, @tinohager, and sorry it sat so long.

Closing because the tree has moved past most of it:

The one piece still worth doing is adding a net8.0 target (with CNG scoped to netstandard2.0). We'll pick that up as a focused change. Really appreciate the contribution.

@darinkes darinkes closed this Jul 14, 2026
Sign up for free to 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.

2 participants