SHFB: Error BE0065: BUILD FAILED: An item with the same key has already been added

Topics: User Forum
Dec 3, 2010 at 12:54 PM

Hi !

I am building Help for a Silverlight 4.0 Class Library (CustomControls Framework) that is referencing :

  • System.Windows.Controls.dll from Silverlight 4 (C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.dll)
  • the Silverlight Toolkit using System.Windows.Controls.dll from Silverlight 3 (C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.dll)

When adding the second reference and building then documentation, I get the error -> SHFB: Error BE0065: BUILD FAILED: An item with the same key has already been added

It seems that the name of the dll is the key of the references list.

To override the problem, I directly edit the shfbproj file modifying the key of references

    <Reference Include="System.Windows.Controls.v3">
      <HintPath>C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.dll</HintPath>
    <Reference Include="System.Windows.Controls.v4">
      <HintPath>C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.dll</HintPath>

And then the documentation build succeed

Whenever you need to add reference to libraries with the same name, you get the error

Would it be possible to directly edit key (used in the shfbproj) in the references treeview ?

Is there another way ?

PS : nevertheless SHFB is a powerful tool I enjoy using

Dec 7, 2010 at 7:39 PM

You can probably use the assembly binding redirection plug-in to redirect the reference to the earlier library version to the newer one.