ilmerge with a PFX file

I recently was attempting to do just the same thing (this time with VS 2015, but I am sure the results are the same).

PFX files are password-protected by default and ILMerge (at the time of this writing) does not appear to support them.

Manual Signing

The "clever workaround" as you describe it is presented here, and it appears to be the only way to accomplish this:

>sn -p some.pfx
>ilmerge / /delaysign /out:merged\some.dll some.dll
>sn -R merged\some.dll some.pfx

Note that extracting the public key from the PFX file requires user input - allegedly it was previously possible to pipe in the password, but the current version of sn.exe does not permit console redirection.

Automated (CI Build System) Signing

In order to strong sign ILMerged assemblies in an automated way, it is necessary to install they key on the local build machine. This still requires user input in the form of password input, but only has to be done once per build machine.

As before, we need to extract the public key from the PFX file (this only has to be done once, and the PUB file can be saved alongside the PFX or even checked-in to source).

Here is the one-time setup code (both require password input):

>sn -p some.pfx
>sn -i some.pfx SomeContainerName

During the automated build, it is now possible to run:

>ilmerge / /delaysign /out:merged\some.dll some.dll
>sn -Rc merged\some.dll SomeContainerName