Thursday, December 11, 2014

MSBuild update C# project file using XmlPoke.

Problem:

I have password protected Click-Once project. And when I try to build it from msbuild I get following exceptions:

1) Microsoft.Common.CurrentVersion.targets(2718,5): error MSB3326: Cannot import the following key file: . The key file may be password protected. To correct this, try to import the certificate again or import the certificate manually into the current user's personal certificate store.

2) Microsoft.Common.CurrentVersion.targets(2718,5): error MSB3321: Importing key file "MyProject.Development_TemporaryKey.pfx" was canceled.

Solution:
Since all I need is to build my solution and run unit tests. I decided to uncheck signing of my project.

To change csproj I used XmlPoke as follows:



 


So now I got my build server running. Next step of course to publish nightly development version for users. But thats another story.

1 comment:

  1. So hard to get this exact right. Thanks, you helped me big time! :-)

    ReplyDelete