Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1704

An assembly with the same simple name 'Assembly Name' has already been imported. Try removing one of the references or sign them to enable side-by-side.

This error points out that two references have the same assembly identity because the assemblies in question lack strong names, they were not signed, and thus the compiler has no way of distinguishing between them in metadata. Thus, the run time ignores the version and culture assembly name properties. The user should remove the redundant reference, rename one of the references, or provide a strong name for them.

This sample creates an assembly and saves it to the root directory.

// CS1704_a.cs
// compile with: /target:library /out:c:\\cs1704.dll
public class A {}

This sample creates an assembly with the same name as the previous sample, but saves it to a different location.

// CS1704_b.cs
// compile with: /target:library /out:cs1704.dll
public class A {}

This sample attempts to reference both assemblies. The following sample generates CS1704.

// CS1704_c.cs
// compile with: /target:library /r:A2=cs1704.dll /r:A1=c:\\cs1704.dll
// CS1704 expected
extern alias A1;
extern alias A2;

Community Additions

ADD
Show:
© 2014 Microsoft