0

I have a multi-project solution in which i want to automate the build process.

The building of that pipeline was successful with signing disabled.

The repository is a legacy TFVC repo which means i cannot work with yaml files unfortunately...

Now when i want to enable signing in the code en upload the new code to build it. I stumble always against the same issue.

##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3202,5): Error MSB3325: Cannot import the following key file: Key.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_0B661CF6DCF2FA7E
 4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current  \Bin\Microsoft.Common.CurrentVersion.targets(3202,5): error MSB3325: Cannot import the following key file: Key.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_0B661CF6DCF2FA7E [D:\a\1\s\Brainsch\Brainsch\Brainsch.csproj]
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3202,5): Error MSB3321: Importing key file "Key.pfx" was canceled.

The key itself in in to repository with the corresponding project.

These are the MSBuild arguments i pass in the build process:

/p:PackageCertificateThumbprint="thumbprint" /p:PackageCertificateKeyFile="$(signingCert.secureFilePath)"

If i put single quotes around the arguments like so:

'/p:PackageCertificateThumbprint="thumbprint" /p:PackageCertificateKeyFile="$(signingCert.secureFilePath)"'

I get this error:

MSBUILD : error MSB1008: Only one project can be specified.
Switch: '/p:PackageCertificateThumbprint=

How can i sign the whole solution in build process in the pipeline?

Clumpsypenguin
  • 311
  • 5
  • 19

1 Answers1

0

Make sure your solution can be signed locally. Then you may try the following items:

  1. Unchecked the "Sign the assembly" checkbox from the "project properties -> Signing" page.

  2. Check your project setting to see whether you have AssemblyOriginatorKeyFile, remove it if it exists.

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • yeah the solution signs locally, so that step allready works – Clumpsypenguin Oct 06 '20 at 10:32
  • Then have you tried the items I provided? Did them work for you? – Cece Dong - MSFT Oct 07 '20 at 09:07
  • my question is why do i need to disable the "Sign the assembly" checkbox? It has to be checked right. That is the whole point of signing the build... – Clumpsypenguin Oct 07 '20 at 09:17
  • There was a community member solved the issue in this way: https://stackoverflow.com/questions/50063626/vsts-build-fails-with-msb3325-cannot-import-pfx-key-file. If this doesn't work for you, I am afraid that you need to setup a self-hosted build agent with that PFX file installed (sn -i). – Cece Dong - MSFT Oct 07 '20 at 09:41