referencing 2 versions of same assembly

J

Jesse Houwing

* M R wrote, On 29-5-2007 13:23:
how can i reference two versions of the same assembly? they exist in two
seperate files. since they have the same name they can't simply be
referenced.

(i am writing a program that updates data that was serialized with version 1
of the class/assembly and store it in the class format for version 2)

I think the only way to do this is to load each assembly in a different
AppDomain. It's not going to be easy. Can't you Update the code in
Assembly 2 to understand the way objects were serialized in Assembly 1?
This is how I usually do this....

Jesse
 
M

M R

how can i reference two versions of the same assembly? they exist in two
seperate files. since they have the same name they can't simply be
referenced.

(i am writing a program that updates data that was serialized with version 1
of the class/assembly and store it in the class format for version 2)

thanks
m
 
C

Christof Nordiek

M R said:
how can i reference two versions of the same assembly? they exist in two
seperate files. since they have the same name they can't simply be
referenced.

Not tested, but should work:

1 In the propertie window of the reference set specific version to true;
2 For each reference in the propertie window aliases enter an identifier
scecific for the version eg. WidgetsV1 and WidgetsV2
3 In codefiles where you want to referent one or both of that assemblies
enter an extern alias directive with the identifier from point 2.
4 reference the class in following form:
WidgetsV1::NamespaceName.ClassName
This also can be done in a using directive.

HTH
Christof
 
C

Christof Nordiek

M R said:
thanks for your reply

The problem is that i can't add additional references. i get an error that
says a reference to that component already exists
Did you set "explicit Version" of the first reference to true, before adding
the second reference?

Christof
 
M

M R

thanks for your reply

The problem is that i can't add additional references. i get an error that
says a reference to that component already exists
 

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