Monday, March 08, 2010

TFS Build error when having a ClickOnce project

We do not have Visual Studio installed on our TFS Build server and it seemed to be failing with the error
The "ResolveKeySource" task failed unexpectedlyerror MSB4018: The "ResolveKeySource" task failed unexpectedly.
error MSB4018: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
error MSB4018: at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

According to this blog post on Ed Squared this is due to the fact that the proj requires a certificate if you have a ClickOnce project whose certificate is not imported and it is trying to load up a dialog to ask for it. As the build is non interactive we get the error

Running MSBuild in the project directory which requires this certificate pops the dialog up and if the password is entered it seems to go ahead and do the build for any future requests. But for this to work for TFS the user will have to logon as the TFS Service for it to cache the certificate



Post a Comment

<< Home