title: Publishing VSTO add-in using MSBuild gives error: The "SignFile" task failed unexpectedly. System.ArgumentNullException: Value cannot be null
body: <p>I am trying to publish a VSTO add-in for Word using MSBuild on a TeamCity build server without Visual Studio. I've done the stuff from these two blog posts:</p>
  
  <p><a href="http://kentb.blogspot.com/2008/08/building-vsto-projects-without-visual.html" rel="nofollow">http://kentb.blogspot.com/2008/08/building-vsto-projects-without-visual.html</a>
  <a href="http://www.wiktorzychla.com/2011/02/msb3147-could-not-find-required-file-on.html" rel="nofollow">http://www.wiktorzychla.com/2011/02/msb3147-could-not-find-required-file-on.html</a></p>
  
  <p>My build file is my Visual Studio solution and my target is "publish". ClickOnce publishing in Visual Studio 2013 on my development machine works fine.</p>
  
  <p>But on the build server, I get this:</p>
  
  <blockquote>
    <p>[SignFile] C:\Program Files
    (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets(612,
    9): error MSB4018: The "SignFile" task failed unexpectedly.
    System.ArgumentNullException: Value cannot be null. Parameter name:
    path1 at System.IO.Path.Combine(String path1, String path2, String
    path3) at
    Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.GetPathToTool()
    at
    Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignPEFile(X509Certificate2
    cert, Uri timestampUrl, String path, ResourceManager resources,
    Boolean useSha256) at
    Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignFile(X509Certificate2
    cert, Uri timestampUrl, String path) at
    Microsoft.Build.Tasks.Deployment.ManifestUtilities.SecurityUtilities.SignFile(String
    certThumbprint, Uri timestampUrl, String path) at
    Microsoft.Build.Tasks.SignFile.Execute() at
    Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at
    Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()</p>
  </blockquote>
  
  <p>I have no idea what this means or how to fix it. Any ideas?</p>