Compiler Warning (level 2) CS1701

Assuming assembly reference "Assembly Name #1" matches "Assembly Name #2", you may need to supply runtime policy

The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly, as demonstrated in the following example code.

Example 1

The following multifile sample references an assembly using two different external aliases. This first sample builds the older version of the code that creates assembly CS1701_d.

// CS1701_a.cs  
// compile with: /target:library /out:cs1701_d.dll /keyfile:mykey.snk  
using System.Reflection;  
public class A {  
   public void M1() {}  
public class C1 {}  

Example 2

This is the code that creates the newer version of assembly CS1701_d. Note that it compiles into a different directory than the older version, necessary since the output files have the same names.

// CS1701_b.cs  
// compile with: /target:library /out:c:\\cs1701_d.dll /keyfile:mykey.snk  
using System.Reflection;  
public class A {  
   public void M2() {}  
   public void M1() {}  
public class C2 {}  
public class C1 {}  

Example 3

This sample sets up the external aliases A1 and A2.

// CS1701_c.cs  
// compile with: /target:library /reference:A2=c:\\cs1701_d.dll /reference:A1=cs1701_d.dll  
extern alias A1;  
extern alias A2;  
// using System;  
using a1 = A1::A;  
using a2 = A2::A;  
public class Ref {  
   public static a1 A1() { return new a1(); }  
   public static a2 A2() { return new a2(); }  
   public static A1::C1 M1() { return new A1::C1(); }  
   public static A2::C2 M2() { return new A2::C2(); }  

Example 4

This sample calls methods using two different aliases of A. The following sample generates C1701.

// CS1701_d.cs  
// compile with: /reference:c:\\CS1701_d.dll /reference:CS1701_c.dll  
// CS1701 expected  
class Tester {  
   public static void Main() {