Wednesday, November 27, 2013

GenerateWinPRTManifestV2 error

Documenting this as Google was unable to find anything. Bing found nothing exact that matched but a few things that pointed me in the right direction.

I've had some "fun" trying to resolve the following error relating to the "GenerateWinPRTManifestV2" task during build.

Error 255 The "GenerateWinPRTManifestV2" task failed unexpectedly.
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifestV2.CCIHarvestRegistrationInformation(ProcessWinmd processWinmd, Dictionary`2 inprocServers)
   at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifestV2.UpdateWinmdRegistration()
   at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifestV2.ExecuteImplementation()
   at Microsoft.Silverlight.Build.Tasks.GenerateWinPRTManifestV2.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

It turns out that there were two projects referencing different copies of the same library and MSBuild wasn't able to differentiate between them. (They weren't strongly named.)

The fix was just to make sure that all the projects in the solution only use one version of any library.

I hope this helps save someone else some time if they hit the issue and end up searching for the same task name.

Remember. Strong names FTW!



1 comment:

  1. Anonymous6:32 pm

    thanks for the advice have same problem, but in a solution with many projects. Have not yeet found the culprit

    ReplyDelete

I get a lot of comment spam :( - moderation may take a while.