views:

41

answers:

3

Hi,

I Get this error when trying to build a project using Team Build (MSBuild) on TFS 2010


C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1970):
Cannot import the following key file: CCC.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_C00C673BBB353901

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1970):
Importing key file "CCC.pfx" was canceled.


It all builds OK in VS 2010. The assembly is signed with a pfx file, usually in Visual Studio we are prompted for the password the first time we build but then never again...

I've tried running sn -i companyname.pfx VS_KEY_3E185446540E7F7A as other replies as suggested here http://stackoverflow.com/questions/2815366/cannot-import-the-following-keyfile-blah-pfx-the-keyfile-may-be-password-prote

I've tried importing into the personal certicificate store as suggested here http://stackoverflow.com/questions/885484/using-msbuild-to-sign-clickonce-or-assembly-error-msb3321

But all to no avail, still the same error.

Is someone out there is using Team Build to build an assembly that is signed?

How do I do it?

Do I have to somehow add the certificate to the windows account the build service runs under or something like that?

Alternatively how do I make the build done in TeamBuild not use signing? I just want to check it compiles and run the unit tests I don't need signing for that.

Thanks, Mike G

A: 

You need to adapt this answer to your specific. Something like:

sn -i companyname.pfx VS_KEY_C00C673BBB353901
heavyd
As you can see from my original post I've already tried this with no success
MikeG
A: 

What I did is not that elegant, but works: log in as the user that runs msbuild on the build machine, manually invoke msbuild, and then type in the password when prompted. It'll now be saved in that user's certificate store, and now the builds can run unattended.

gregmac
A: 

What finally fixed it for me was making the account under which TFS Build service runs an administrator on the local machine.

Don't know though if any of the other stuff I was trying before also needs to be done to get it working. But before it was admin it didn't work after it became admin it worked.

MikeG