Configure strong-named assemblies for .NET
Add support for strong-named assemblies to your C# SDK, which creates a unique identity for the assembly and prevents assembly conflicts.
Strong-named assemblies are a .NET mechanism to give assemblies a unique ID. This provides several benefits, including the ability to have your assembly installed in the global assembly cache.
To enable strong-named assemblies, you will need a base64-encoded assembly originator key and corresponding public key. You can generate these keys on a Linux or Mac system (or on WSL) using the following commands:
export TEMP_SNK=mktempsn -k $TEMP_SNKcat $TEMP_SNK | base64 -w 1000 # this is your base64-encoded assembly originator keysn -tp $TEMP_SNK | grep -oE '^[0-9a-f]+$' | tr -d '\n'; echo # this is your public keyrm $TEMP_SNK # cleanupOnce you have your keys, add them to your Stainless config like so:
targets: csharp: ... strong_name: originator_key: foo # your base64-encoded assembly originator key public_key: bar # your public keyWhen you add those keys to your Stainless config, an Open.snk file will be added to your C# repository automatically, and strong-name signing will be enabled at build and publish time.