views:

92

answers:

1

I'm having a problem with assembly references. I have four assemblies:

  1. A class library called EncryptionUtils
  2. Another class library called PasswordUtils that uses EncryptionUtils
  3. Another class library called Toolkit that is an ILMerge of many libraries, including EncryptionUtils
  4. A WPF application that uses Toolkit and PasswordUtils

In my WPF app, if I don't include a reference to EncryptionUtils, I get the following error:

The type 'EncryptionUtils.RSAPublicKey' is defined in an assembly that is not referenced. You must add a reference to assembly 'EncryptionUtils, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

However, once I add a reference to the very same EncryptionUtils that both PasswordUtils and Toolkit were built with, I get the following error:

The type 'EncryptionUtils.MyClass' exists in both 'c:...\EncryptionUtils.dll' and 'c:...\Toolkit.dll'

How do I get out of this catch 22?? Do I have to add all the individual libraries that make up Toolkit to my WPF app?

+1  A: 

Either add the libraries to the WPF app individually (which is what I'd tend to recommend) or merge PasswordUtils into Toolkit, and remove the reference to PasswordUtils.

You could potentially use an extern alias to specify which type you mean - but having the same type available in two assemblies is a bit of a recipe for disaster, IMO.

Jon Skeet
Adding the libraries individually worked. Thanks!
Sarah Vessels