Assembly Version Issues

  • Thread starter Christopher Pragash
  • Start date
C

Christopher Pragash

Hello All,

I am developing a "Business Object" Assembly and "Data Object" Assembly
(Remoted) , both of which would be called from .NET and from ASP (using COM
layer Interop). I deployed all the assemblies into the GAC and it had a
specific version when I deployed it. I developed a service that hosts the
Remoting Objects and I deployed the dlls in the GAC and things worked fine.

I made a few changes to the COM Interop layer, and when I complied it the
versions became different, and even after I manually deploy it to the GAC,
the Service does not load the Dll from the GAC, even after restarting the
service. It always loads the Dll from its Bin Directory. How can I resolve
this issue? How do I make all the projects load the assemblies from the GAC?
Is there a way I could force this?

Thanks in advance...

regards,
Chris
 
J

Jim Blizzard [MSFT]

Hi Chris,

Thanks for posting your question.

There are a couple of things you can do to make things easier.

When you're calling .net assemblies through COM interop you're dealing with
the world of the registry again. So it helps if you assign your .NET class
a GUID. It's kinda' like setting "binary compatibility" on in VB6. (It's a
stretch, but you could think of it that way.) You can do this by importing
System.Runtime.InteropServices and adding the Guid attribute to the class,
such as
:
Imports System.Runtime.InteropServices
<Guid("C4ACAC63-A35D-4a0f-9AA1-26DA6313D717")> Public Class MyClass
:
and so on. (Change the decorations as appropriate for a C# version of
this.)

Another thing you can do is explicitly set the version number in the
AssemblyInfo file. The default AssemblyVersion is "1.0.*" which lets VS.NET
change the version number every time you compile. Go ahead and manually
assign all 4 digits yourself, such as "1.0.0.0" and then you can control
when the version number changes.

Hope this helps,
bliz

--
Jim Blizzard | http://weblogs.asp.net/jblizzard
Sr .NET Developer Specialist
Microsoft

Your Potential. Our Passion.

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only, so that others may benefit. Thanks.
 
C

Christopher Pragash

Hello Jim,

Thanks for the response. Manually controlling the version number did resolve
some of my issues. I'm having trouble loading the right Assembly. My windows
service that hosts the remoting object always loads the assembly from the
Bin directory, even though I have the assembly installed in the GAC. How do
I force the service to load the assemblies from the GAC? Is this possible?

Thanks in advance again...appreciate your effort.

Thanks,
Chris
 
J

Jim Blizzard [MSFT]

Hi Chris,

This MSDN library article should help:
"How the Runtime Locates Assemblies" :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconhowruntimelocatesassemblies.asp

(watch out for line breaks in the URL)

And underneath that section (look in the table of contents) there are a
number of steps the runtime goes through, described in even more detail.

I wish I had a quick answer for you....

Hope this helps,
bliz
--
Jim Blizzard | http://weblogs.asp.net/jblizzard
Sr .NET Developer Evangelist
Microsoft

Your Potential. Our Passion.

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only, so that others may benefit. Thanks.


--------------------
From: "Christopher Pragash" <[email protected]>
References: <[email protected]>
 

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