We just had an XBAP/WBA project added to our build server. It uses a PFX file for signing. I imported the PFX file to the CruiseControl.NET service certificate store, and can see it in the certificate store for the service. Yet we are still seeing an exception thrown by ResoveKeySource:
c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets (1805,7): errorMSB4018: The "ResolveKeySource" task failed unexpectedly. 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. at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
I also enabled (in hope more than knowledge) the service to interact with the desktop.
Has anyone seen this behaviour or can recommend another approach? I know I can run CruiseControl.NET as a user (the solution is compiling from command line), but would like to avoid if possible since all the permissions are configured against the service account, and would prefer running as a service.
Thanks to Preet's suggestion, I was able to get it working using the following process:
- Created a user for the CruiseControl.NET service.
- Gave user log on as a service rights and changed CruiseControl.NET service to run as this user.
- Logged on as this user and ran the XBAP project from the command line.
- Entered the PFX password when prompted by ResoveKeySource task.
- Tested building from CruiseControl.NET, green lights, horray!
What is interesting is that as part of step 3. After logging on as this user, I imported the PFX file into it's certificate store before running MSBuild from command line. This didn't solve the problem, I had to build the project from the command line, enter the password and then it worked from CruiseControl.NET service.
Thank you Preet!
来源:https://stackoverflow.com/questions/1587247/cruisecontrol-net-service-failing-to-build-due-to-msbuild-resolvekeysource-error