Fork me on GitHub

How to make signed assembly?

Gentoo Mono Handbook
mono.snk - installation and usage
There are 4 tools to sign the assembly - portage, msbuild, sn and mcs

portage

There is a special function exbuild_strong in dotnet.eclass
    https://github.com/gentoo/dotnet/blob/7b316f212e670192162257791d231c7a050ed489/eclass/dotnet.eclass#L131

msbuild

dev-dotnet/monotorrent
    exbuild /p:SignAssembly=true "/p:AssemblyOriginatorKeyFile=${WORKDIR}/mono.snk" "${METAFILETOBUILD}"
dotnet.eclass
    KARGS2=/p:AssemblyKeyContainerName=mono

signing support is added into the Microsoft.Common.targets file.
To do this via the command line you need to set two properties: SignAssembly and AssemblyOriginatorKeyFile.

	exbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=${WORKDIR}/mono.snk "${METAFILETOBUILD}"
http://blogs.msdn.com/b/msbuild/archive/2005/09/26/474079.aspx
when the AssemblyKeyFile flag is specified, you need to add a path because the al command is executed in the binDebug directory
/p:DelaySign=true

sn

dev-dotnet/microsoft-web-infrastructure
    sn -R "${S}/mcs/class/${NAME}/bin/${DIR}/${NAME}.dll" "${S}/mcs/class/mono.snk" || die

mcs

dev-dotnet/mono-options
    PARAMETERS=-keyfile:mcs/class/mono.snk

not all key formats are supported:
http://stackoverflow.com/questions/7492822/mono-xbuild-error-cs1548-key-file-has-incorrect-format