refer the version

K

kalaivanan

hi,
i am using two versions of a particular dll cust.ll.
how do i make a class file to refer the two versions of cust.dll.

eg:
version one :
using System;
using System.Reflection;

[assembly: AssemblyKeyFile("test.txt")]
[assembly: AssemblyVersion("2.0.0.0")]

public class cust
{
public void NameTwo()
{

Console.WriteLine("testing assembly from version two");
}
}

sn -k test.txt
csc /t:library cust.dll
gacutil -i cust.dll

==================================
version two :
using System;
using System.Reflection;

[assembly: AssemblyKeyFile("test.txt")]
[assembly: AssemblyVersion("3.0.0.0")]

public class cust
{
public void NameThree()
{

Console.WriteLine("testing assembly from version three");
}
}

sn -k test.txt
csc /t:library cust.dll
gacutil -i cust.dll

===================================

client file

using System;
public class Client
{
public static void Main()
{
cust obj = new cust();
obj.NameTwo();
obj.NameThree();
}
}

csc /r:cust.dll client.cs

when i execute this i am getting the following error:
'cust' does not contain a definition for NameTwo
 
M

Mattias Sjögren

i am using two versions of a particular dll cust.ll.
how do i make a class file to refer the two versions of cust.dll.

You can reference both assemblies separately (csc /r:alias=assembly)
and by using the extern alias statement.

using System;
public class Client
{
public static void Main()
{
cust obj = new cust();
obj.NameTwo();
obj.NameThree();
}
}

This, however, will not work. You'll have two separate cust types, and
you can only call NameTwo on one and NameThree on the other.


Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top