Link to home
Start Free TrialLog in
Avatar of Razzie_
Razzie_

asked on

600 Points: Using regasm with /codebase - bad?

Hey all,

This will be an additional 500 points on a complete satisfactory answer (I have an open question with similar problem for 500 points).

I've been messing around with a problem found here (not really necessary to read): https://www.experts-exchange.com/questions/21122681/EXPERT-Registering-COM-dll-on-other-machine.html

After an extremely long time I finally managed to get it to work. However, in order to make it work, I have to register my project dll with regasm.exe using the /codebase parameter. Now I read this post of someone (scroll down for the last post): http://dotnetjunkies.com/Newsgroups/microsoft.public.dotnet.distributed_apps/2004/2/27/40357.aspx

that you should *never* register with regasm using /codebase. Well, since I know very little about these things, and I've been working on this for a week now and know no other way than to make this work, I'm a little bit like 'uhu, whatever'.

Can someone explain me what the chances are of errors when doing so? Is it really that bad? And, if it is, is there a way to fix this? (will need to read my 500 point question for this). I will only accept very good answers for 600 points, either by providing a solution to my other post, or when the answer is complete, detailed, and understandable what the problem is with /codebase or why I can use it anyway ;)

Thanks,

Razzie
SOLUTION
Avatar of tomasX2
tomasX2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Razzie_
Razzie_

ASKER

yeah but "If multiple applications have assemblies without strong names that contain types with the same names, subtle incorrect behaviour can occur by the wrong types getting loaded"

now THAT's what I'm wondering. What does it mean *exactly*? 2 Object of the same type with the same name? What are the chances of this? Can this happen every time, or is the chance like 1 in 10 million? Does giving your class a ridiculous circumvent this?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Razzie_

ASKER

NipNFriar_Tuck,

It sure helps. But still a few questions.

As I understand it, if you use a 'special' namespace of which you are let's say 99,99% sure nobody else will use it, you are in principal safe to use the /codebase parameter?

'To get your code to work without using /codebase on the regasm you would simply put all of the dll's that your code needs in the same directory' - they are in the same directory, I uploaded my whole output directory to another directory on the deployement machine. I did the regasm.exe without /codebase, and it said something like 'Assembly registered succesfully'. However, after doing a few tests on the deployement machine, I was absolutely sure that it didn't really do anything, because I saw no difference after registering. Are you sure it should work? If you are, I might try to clean up the register and start from scratch.

Thanks,

Razzie
I would say if the risks are acceptable then using /codebase may be a solution, however I would make sure to document it since a year down the road when this conversation is long forgotten and the applications starts acting up you do not want to be in the dark.

I am also 99% sure that putting the dlls in the same directory as the code should work.  One thing that may be an issue is if you did not use the copy local parameter on all referenced assemblies to copy all referenced assemblies to the output directory, since then you would be missing a dll.
Avatar of Razzie_

ASKER

Well I experienced myself that it can cause problems when hooking it to my SMTP server twice, unfortunately I really can't register without the /codebase. But since I simply changed my namespace into something else, the problems were gone, I just need to document it right like you said Nip, and it won't be too bad. The chances of it interfering with completely different applications are - as I understand it - very very slim that way.

This will work for me since I have no other problems now anymore.