Поделиться через


TFSBuild fails with error MSB4018 "ResolveKeySource" task failed unexpectedly

When you upgrade from TFS 2005 to TFS 2008, if your project has strong name setup then building your solution from TFSBuild might throws error:

Target "ResolveKeySource" in file "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets" from project "e:\build\abc\ccc.csproj":
Using "ResolveKeySource" task from assembly "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "ResolveKeySource"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): error MSB4018: The "ResolveKeySource" task failed unexpectedly.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): 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.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): error MSB4018: at Microsoft.Build.Shared.ExceptionHandling.RethrowUnlessFileIO(Exception e)
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): error MSB4018: at Microsoft.Build.Tasks.ResolveKeySource.ResolveAssemblyKey()
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): error MSB4018: at Microsoft.Build.Tasks.ResolveKeySource.Execute()
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1728,7): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
Done executing task "ResolveKeySource" -- FAILED.

Following below step will resolve the issue:

1. Login to the build machine as Build Service account

2. Start commandline and run you project ccc.csproj using MSBuild
MSBuild.exe e:\build\abc\ccc.csproj /t:rebuild

3. It should prompt for signing key password, type you password that will export the key

4. They try to build it from TFSBuild.