Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strong name signing for netstandard libraries #1102

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*.yml text

*.sln text
*.snk binary

*.csproj text
*.cs text eol=crlf
Expand Down
6 changes: 1 addition & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,8 @@ SPDX-License-Identifier: GPL-3.0-only
<SelfContained>false</SelfContained>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<GenerateDependencyFile>false</GenerateDependencyFile>
<!--
See https://github.com/dotnet/roslyn/issues/41640
-->
<!-- See https://github.com/dotnet/roslyn/issues/41640 -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PublishDocumentationFiles>false</PublishDocumentationFiles>
<NoWarn>CS1591</NoWarn>
Expand Down
13 changes: 12 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2024 Frans van Dorsselaer

SPDX-License-Identifier: GPL-3.0-only
-->
<Project>

<PropertyGroup>
<!-- This is not set by default, but this is the sane default. -->
<IsTrimmable Condition="'$(IsTrimmable)' != 'false' And $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<!-- This is not set by default, but this is the sane default. -->
<IsAotCompatible Condition="'$(IsAotCompatible)' != 'false' And $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<!-- This is set to false by default, but this is a better sane default. -->
<!-- See: https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming#create-strong-named-net-libraries -->
<SignAssembly Condition="$(TargetFramework.Contains('netstandard'))">true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\strongname.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<Target Name="RemoveDebug" AfterTargets="Publish">
<ItemGroup>
<DebugFiles Include="$(PublishDir)\**\*.pdb" />
Expand Down
6 changes: 6 additions & 0 deletions UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "zAwp213evC3UkimtVXRb+Dlgc/40QG145nmZDtp2LO9zJJMfrp+i/87BnXN7tRXEA4liyzdFkjqG1HE8/RPb4A=="
},
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
"requested": "[17.12.0, )",
Expand Down
Binary file added strongname.snk
Binary file not shown.
3 changes: 3 additions & 0 deletions strongname.snk.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2024 Frans van Dorsselaer

SPDX-License-Identifier: GPL-3.0-only
Loading