views:

217

answers:

0

I've written a .Net WCF Office 2007 app which uses ClickOnce as an installer. I'm using MSBuild via commandline to sign it, but I'm getting the following error:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018: T
he "SignFile" task failed unexpectedly.\r
C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018: S
ystem.NullReferenceException: Object reference not set to an instance of
 an object.\r
C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018:
  at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilitie
s.SignFile(X509Certificate2 cert, Uri timestampUrl, String path)\r
C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018:
  at Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilitie
s.SignFile(String certThumbprint, Uri timestampUrl, String path)\r
C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018:
  at Microsoft.Build.Tasks.SignFile.Execute()\r
C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\OfficeTools\Microso
ft.VisualStudio.Tools.Office.Office2007.targets(250,9): error MSB4018:
  at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(Engi
neProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTa
sk, ITask task, Boolean& taskResult)

I'm using the command line:

c:/windows/microsoft.net/framework/v3.5/msbuild.exe /p:Configuration=Release /p: ManifestCertificateThumbprint={mycert-thumbprint} /m /consoleloggerparameters:ErrorsOnly d:\project\app.sln

Things I've tried:

  1. All certs have been installed via mmc.exe Certificates addin, and are listed under "Personal" certificates for the build user.
  2. I have a local made cert, and if I use the thumb-print for it in the command line it builds without a single error. The error is occuring using my "live" officially signed cert.
  3. If I remove the installed "live" cert via mmc.exe the error changes to something along the lines of "cannot find cert". So it is finding the cert when trying to sign.

This leads me to believe it's either having problems with the live cert (maybe the type, encryption etc...). Or I haven't installed it correctly.

The error is getting thrown in the Visual Studio Office 2007 build targets, so it's not easy to see why (short of figuring out which assembly it comes under and using Reflector) Has anyone seen this issue before, or know a work around? I can't release my app until I can sign it!