Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / April 2006

Tip: Looking for answers? Try searching our database.

Classic ASP and multiple versions of comvisible .net classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wayne Sepega - 10 Apr 2006 13:58 GMT
I have a class assembly that I have made visible via com. I've strong named
it, put it in the GAC, and registered it with RegAsm, and have successfully
called it from ASP and a VBScript file. I then incremented the version # of
the assembly and made a slight code change. The ASP and VBScript call the
new version of the object. I need to figure out how to force the VBScript
and ASP to call the old version, or rather a specific version of the
assembly. I've seen in the help and google results that you can define a
policy in a manifest or in your config file for the calling application, but
I don't have a calling application. I also may need each ASP file to be able
to call a specific version, not necessarily the same version for every ASP
file.

Any ideas?

Thanks
Wayne
Dmytro Lapshyn [MVP] - 10 Apr 2006 15:36 GMT
Hi Wayne,

There's a COM trick known as version-dependent ProgIDs. The idea is that
every version of the COM object has its own ProgID with the version number
specified:

Example.ProgID.1.0

In hope that .NET supports this convention, try appending the version number
after putting an additional dot trailing the usual ProgID you use. This
might work. However, you should be very careful to ensure the old and new
versions of the COM-visible DLL don't intersect in terms of IIDs, ClassIDs,
Type Library IDs, etc. Otherwise, the DLL Hell is guaranteed.

>I have a class assembly that I have made visible via com. I've strong named
>it, put it in the GAC, and registered it with RegAsm, and have successfully
[quoted text clipped - 12 lines]
> Thanks
> Wayne
Wayne Sepega - 10 Apr 2006 19:50 GMT
Just want to make sure I understand you correctly, this is what I have for
my class declaration:

[Guid("A5A814B3-4A08-468d-A387-047059AB9D14")]
[ComVisible(true)]
[ProgId("ComTest.Numbers")]
public class Numbers : INumbers
{
}

So what you are suggesting is to add .1.0 to ComTest.Numbers, this way it
keeps the name unique.

Believe I fully understand that part. Now for the DLL Hell comment. In the
example above your suggesting that I need to change the GUID with each new
version of the Assembly? Also with this guid:
[assembly: Guid("9c832876-953f-4382-a441-a243d657a28b")]? and any other guid
I might have, say one for the INumbers interface?

Thanks
Wayne

> Hi Wayne,
>
[quoted text clipped - 26 lines]
>> Thanks
>> Wayne
Dmytro Lapshyn [MVP] - 11 Apr 2006 07:15 GMT
Hi Wayne,

> So what you are suggesting is to add .1.0 to ComTest.Numbers, this way it
> keeps the name unique.
>
> Believe I fully understand that part.

Hmmm. I'd expect the IDE or runtime to create version-dependent ProgIDs for
you. It's unlikely you have to add "1.0" manually.

> Now for the DLL Hell comment. In the example above your suggesting that I
> need to change the GUID with each new version of the Assembly? Also with
> this guid:
> [assembly: Guid("9c832876-953f-4382-a441-a243d657a28b")]? and any other
> guid I might have, say one for the INumbers interface?

Yes, you are absolutely right. It's actually good you define all GUIDs
explicitly - otherwise you might end up figuring out those the IDE generates
silently for you (e.g. Type Library ID).

> Just want to make sure I understand you correctly, this is what I have for
> my class declaration:
[quoted text clipped - 48 lines]
>>> Thanks
>>> Wayne
Dmytro Lapshyn [MVP] - 11 Apr 2006 07:42 GMT
You may find the following article of interest as well:

http://www.simple-talk.com/2005/03/09/com-server-registration/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.