A problem that I and many others have had occurs whe you use TFS Build to build projects that are signed with a password protected strong name key. When the project is built the first time in Visual Studio a dialog pops up prompting for the password. In an automated build process this dialog cannot be displayed, which results in the following error:
To work around this issue, follow these steps:
C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1805,7): error MSB4018: 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) at System.Windows.Forms.Form.ShowDialog() at Microsoft.Build.Tasks.ResolveKeySource.ResolveAssemblyKey() at Microsoft.Build.Tasks.ResolveKeySource.Execute() at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
To work around this issue, follow these steps:
- Log on to the build server with the account used for tha automated builds (normally the TFS service account).
- Open a command prompt and navigate to C:\WINDOWS\Microsoft.NET\Framework\v3.5\
- Run msbuild "C:\Project\Project.sln" /t:rebuild for each project (.csproj) or solution (.sln) that contains password protected strong name keys.
- Enter the password when the prompt is displayed. The certificate is then saved in the certificate store for the service account.
- Restart the Visual Studio Team Foundation Build service.
Comments
Post a Comment