Click here to Skip to main content
13,138,372 members (49,036 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I created a dll called A.dll and strong named it with version and compiled it.Then I copy pasted this A.dll into a local folder. Then I increased the version of A.dll to and compiled to get new A.dll.
Then again I tried to place the latest dll into that local folder, expecting both versions should exist side by side as it does in GAC. But I cant..
Please tell me how to achieve that?
(I dont want to use the GAC)
Posted 16-Feb-13 0:00am
Richard MacCutchan 16-Feb-13 6:14am
You cannot have two files with the same name in the same folder.
Logi Guna 16-Feb-13 14:15pm
Why not put v2.0 dll in different folder?
It's simple, just add AssemblyResolve event for v2.0 dll.
OP commented:

Yes it is a better solution to have the two assemblies in subfolders v1.0 and v2.0 ... I was thinking if I could manage to have them in the same folder some how ...
Of course you can do it, but you are thinking in wrong direction. The best you can do is having only one version.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Lets say GAC is a special folder that keep track of files not just by name but by version too. Thus, it allows assemblies of same name but different version.

Local folder does not care for version. If it has files of same name, it would not allow to copy.
Sergey Alexandrovich Kryukov 16-Feb-13 20:34pm
I think OP needs much simpler answer at this moment, not a solution. By the way, using GAC is not an acceptable (more exactly, not good enough as it would require complex uninstallation) solution for assemblies used only in one product. The root problem is some versioning and versioning policy.
Please see my answer. It the problem can be formulated more to the point, we might suggest a solution.
debdeep Bhattacharyya 16-Feb-13 23:49pm
yes GAC shouldnt be added with just any dll just because some local exe needs its various versions.
Sandeep Mewara 17-Feb-13 0:02am
I have not suggested to use GAC. Please re-read my answer. I have used GAC to compare and make OP understand what is happening and the reason why he cannot put two different version dll in a normal folder.
Sure; I know. I just didn't express myself clearly. My not about GAC is not related to the question. I only wanted to confirm OP's idea about not using GAC. My idea was just to dismiss two identically named files in the same directory. This is all deserved by this question. Everything else might come only after OP's clarification.
Sandeep Mewara 17-Feb-13 0:20am
Sorry SA, my comment was directed to debdeep who answered your comment. I did got your point first time. OP looked like novice to even understand why same name assembly cannot be in a folder so I had to use GAC example.

Please see further discussion below Solution 2. I clearly explain now what's the problem.
No, I'm sorry for my confusion.

I see, please see further discussion of Solution 2. Unfortunately, OP clarification only clarifies that OP holds the same line thinking over some suggested ways of solving the problem instead of the problem itself.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You cannot have two file with identical names in the same directory, by definition. And you never ever need it.

If you explain your ultimate goal, you might have a chance to get some practical advice. You apparently experience some versioning problems with your product. But them address this problem instead of putting unnatural requirements to file systems and asking the questions based your (correct or wrong) understanding of how to solve the problem. Ask about your problem itself.

debdeep Bhattacharyya 16-Feb-13 23:47pm
My problem:
I have two executables they are located in the same folder and uses same dll, one exe calls the other during its execution and looks for it in local folder. I have no control over code of those exes.
Now I want to replace the dll with newer version as I have source code of that dll, however I want one exe to use the older version and another to use the newer version.
You again asking not about resolution of some problem, but about your suggested way of doing things. Your way is wrong. We should not talk about "two executables in the same folder", not about "replace DLL with newer version". Those are all misconceptions. We should talk about why doing all that, starting from your original, ultimate goals.
Perhaps you should learn about assembly resolution (and at this point you should dismiss the idea of using the same directory; why?!); or you should think about general problem of versioning and compatibility. But it's more likely that you simply need to unify versions.

debdeep Bhattacharyya 17-Feb-13 0:28am
can u suggest some article(easy to understand) that should lead me to light?
Sandeep Mewara 17-Feb-13 0:30am
Totally agree with SA.
You can do search by these keywords.

I suggest you do completely different direction: how to properly support version. Supporting two different versions for different applications of the same product is not wise. If you lean some techniques (eventually you will), it will only bring your away from right approach.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100