PFX - Different public keys on AppVeyor servers (.NET/Visual Studio)

murarialex's Avatar


29 Sep, 2020 04:20 PM


In my .NET Standard project I added a InternalsVisibleTo attribute so the test project could access internal members of my main project, since the projects are strongname-signed I used the sn.exe tool (from .NET Framework) to extract the test project's public-key to add it to the InternalsVisibleTo parameter. Everything works correctly in my dev machine, but in the AppVeyor server, the public-key generated for the same assembly is different, so the build breaks. The repository code/commit is exaclty the same (it is automatically triggered on GitHub commit).

One thing I noticed is that the PFX container name differs from my dev machine to the AppVeyor server.

How can the same PFX and assemblies generate different keys and same PFX have different container names?

Additional info: I found troublesome how the import PFX stuff works on AppVeyor, so I use a custom script to import the PFX. It worked like a charm until today when I hit this public key problem.

The Import-PFX script:
Used like this: Import-PfxCertificate -pfx "$env:APPVEYOR_BUILD_FOLDER\ExprelsiorKey.pfx" -password $env:certificate_pass -containerName $env:certificate_container_name;

The build log:

The AppVeyor yml file:


  1. 1 Posted by murarialex on 29 Sep, 2020 05:04 PM

    murarialex's Avatar

    I found a solution:

    In your PowerShell: Start-Process -FilePath "$env:APPVEYOR_BUILD_FOLDER\SnInstallPfx.exe" -ArgumentList "$env:APPVEYOR_BUILD_FOLDER\ExprelsiorKey.pfx $env:certificate_pass" -NoNewWindow.

    That custom ImportPfx-Certificate script was making something wrong.

  2. Support Staff 2 Posted by Feodor Fitsner on 29 Sep, 2020 05:27 PM

    Feodor Fitsner's Avatar

    That's weird, we use Import-PfxCertificate in AppVeyor internal builds to sign .msi packages without any issues.

    That's great, you've managed to find a solution.

    Just curious, what if you try rebuilding some previous successful commit, just to make sure that it's not environment change?

  3. Feodor Fitsner closed this discussion on 29 Nov, 2020 09:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac