473,769 Members | 3,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling assemblies compiled in different framework versions

I have a service which is used to call differenct versions
of an application depending on the database version that
is being used.

The service has been compiled in framework 1.1 and it
needs to call the current version of the application (also
compiled in framework 1.1) and also historic versions
(compiled in framework 1.0).

The application compiled in framework 1.1 loads correctly,
however, when it attempts to load the assemblies compiled
in framework 1.0 I get an InvalidCastExce ption when
calling the unwrap method. Example code is shown below:

ObjectHandle obj = System.Activato r.CreateInstanc e
(fullAssemblyNa me, pc.Type);
IInstance m_instance = (IInstance)obj. Unwrap();

The DLL highlighted by the thrown exception is stored in
the GAC. And a different assembly version applies to each
instance. I have a application config file but it doesn't
appear to have had an effect.

Any Ideas?

Nov 15 '05 #1
4 2046
Where is IInstance defined? If the IInstance in your service is not the
same IInstance that is implemented in the other assembly then you'll get the
InvalidCastExce ption. Remember that a type with the same name in 2
different assemblies is considered 2 different types.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Richard" <an*******@disc ussions.microso ft.com> wrote in message
news:0c******** *************** *****@phx.gbl.. .
I have a service which is used to call differenct versions
of an application depending on the database version that
is being used.

The service has been compiled in framework 1.1 and it
needs to call the current version of the application (also
compiled in framework 1.1) and also historic versions
(compiled in framework 1.0).

The application compiled in framework 1.1 loads correctly,
however, when it attempts to load the assemblies compiled
in framework 1.0 I get an InvalidCastExce ption when
calling the unwrap method. Example code is shown below:

ObjectHandle obj = System.Activato r.CreateInstanc e
(fullAssemblyNa me, pc.Type);
IInstance m_instance = (IInstance)obj. Unwrap();

The DLL highlighted by the thrown exception is stored in
the GAC. And a different assembly version applies to each
instance. I have a application config file but it doesn't
appear to have had an effect.

Any Ideas?

Nov 15 '05 #2
Thanks

Am I correct in assuming that the only way around this is
to recompile the application with references to the same
interface?

Richard
-----Original Message-----
Where is IInstance defined? If the IInstance in your service is not thesame IInstance that is implemented in the other assembly then you'll get theInvalidCastExc eption. Remember that a type with the same name in 2different assemblies is considered 2 different types.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.

"Richard" <an*******@disc ussions.microso ft.com> wrote in messagenews:0c******* *************** ******@phx.gbl. ..
I have a service which is used to call differenct versions of an application depending on the database version that
is being used.

The service has been compiled in framework 1.1 and it
needs to call the current version of the application (also compiled in framework 1.1) and also historic versions
(compiled in framework 1.0).

The application compiled in framework 1.1 loads correctly, however, when it attempts to load the assemblies compiled in framework 1.0 I get an InvalidCastExce ption when
calling the unwrap method. Example code is shown below:

ObjectHandle obj = System.Activato r.CreateInstanc e
(fullAssemblyNa me, pc.Type);
IInstance m_instance = (IInstance)obj. Unwrap();

The DLL highlighted by the thrown exception is stored in
the GAC. And a different assembly version applies to each instance. I have a application config file but it doesn't appear to have had an effect.

Any Ideas?

.

Nov 15 '05 #3
And shouldn't an application config file be able to help?
-----Original Message-----
Thanks

Am I correct in assuming that the only way around this is
to recompile the application with references to the same
interface?

Richard
-----Original Message-----
Where is IInstance defined? If the IInstance in yourservice is not the
same IInstance that is implemented in the other assembly

then you'll get the
InvalidCastEx ception. Remember that a type with the samename in 2
different assemblies is considered 2 different types.

--
--Grant
This posting is provided "AS IS" with no warranties, and

confers no rights.


"Richard" <an*******@disc ussions.microso ft.com> wrote in

message
news:0c****** *************** *******@phx.gbl ...
I have a service which is used to call differenct

versions of an application depending on the database version that is being used.

The service has been compiled in framework 1.1 and it
needs to call the current version of the application(also compiled in framework 1.1) and also historic versions
(compiled in framework 1.0).

The application compiled in framework 1.1 loadscorrectly, however, when it attempts to load the assembliescompiled in framework 1.0 I get an InvalidCastExce ption when
calling the unwrap method. Example code is shown below:

ObjectHandle obj = System.Activato r.CreateInstanc e
(fullAssemblyNa me, pc.Type);
IInstance m_instance = (IInstance)obj. Unwrap();

The DLL highlighted by the thrown exception is stored in the GAC. And a different assembly version applies toeach instance. I have a application config file but itdoesn't appear to have had an effect.

Any Ideas?

.

.

Nov 15 '05 #4
Possibly a config file can help. It all depends on where IInstance is
defined. If IInstance is in the application, then you're stuck. If
IInstance is in the service, then you might be able to get it working
without recompiling.

If I were to design this from the ground-up, I would have 1 assembly/dll
that just has interfaces like IInstance that dictate how the application and
the service communicate. That assembly is now the 'lowest common
denominator'. Then the application and service both reference that assembly
when they build.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3330
by: Logan | last post by:
I have two different Python versions on my Linux system (2.2 and 2.3). I cannot remove version 2.2 because many configuration files of the system depend on this version of Python (and its extensions). Now I want to install extension packages for Python 2.3; if the package is distributed via Distutils, this is no problem: 'python2.3 setup.py install' will do the job (i.e. put everything in the 'site-packages' folder of Python 2.3).
2
1511
by: Roger | last post by:
Hi All, If a user runs a Framework 1.0 app, and then opens a 1.1 app, and then opens a 1.2 app (when version 1.2 comes) , does this mean that all three versions of the Framework will be loaded into memory? All 3 doing GCing and jit-ing and negotiating for available memory? I'm assuming yes, since VS7 can't be used with 1.1. Thanks,
3
1528
by: zorro | last post by:
Hello, If I have to test my code on different Netscape versions, can I download and run those versions on the same computer or will it create conflicts? And if I had to test only one version which one should it be - which one has the most common elements to all the versions?
2
1526
by: ken | last post by:
I may need to have front ends configured for Access 2002 and 2000 and have one access 2000 backend. I think it might work? Right now I have access 97 and 2k on my computer and when I tried linking to a table from 2k to 97 it took it. So I'm thinking that if I have Frontends configured for different access versions and 1 backend I might be able to solve my problem. comments? THanks in advance.
3
1244
by: Dakkar | last post by:
I wrote a program with english .net framework version but i want people who use turkish .net framework versions to be able to use my program but its giving the language error when somebody with a .net framework version which has language beside english try to execute my program. So how can i be able to compile my program for both languages Posted Via Usenet.com Premium Usenet Newsgroup Services...
1
1360
by: Tim Bücker | last post by:
Hello. Are there any resources out there (because I couldn´t find any) concerning the usage of assemblies with different features in each version? In other words: I´ve got one assembly A that is using assembly B - B exists in different versions. Now I want to make it possible for A to ask B what features it supports or what data it can give to A.
2
1127
by: ieg999 | last post by:
I have an ASP.NET 2.0 application that uses mulitple assemblies. I need certain assemblies to use .NET 1.1. These are library (DLL) assemblies used in my application. These same DLLs are also used in a WinForm app that will still be using 1.1 so they can't be updated to the newer version at this point. How can I set my application to require that 1.1 is used for these DLL assemblies? In reasearching this, it appears that ASP.NET wants...
1
1452
by: jonas | last post by:
I have a problem with different .NET Framework versions in virtual directories. Virtual directory /folder_a, is configured as an application running ..NET Framework 2.0 and contains an ASP.NET 2.0 app. Virtual directory /folder_a/folder_b, is configured as an application running .NET Framework 1.1 and contains an ASP.NET 1.1 app. When i run the webb applikation in /folder_a/folder_b, it tries to use
3
1658
by: paulsnz | last post by:
Hi I am trying to use the SoftwareAudit.exe command accross a number of Windows server platforms. they have various framework versions implemented and the command only works on some versions. Can anyone tell me what versions the command should work on and if there is a equivalent command for the other versions? cheers .................... Paul
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.