Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I created a dll called A.dll and strong named it with version 1.0.0.0 and compiled it.Then I copy pasted this A.dll into a local folder. Then I increased the version of A.dll to 2.0.0.0 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
Comments
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.
See http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
Sergey Alexandrovich Kryukov 17-Feb-13 1:10am    
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 ...
Sergey Alexandrovich Kryukov 17-Feb-13 1:11am    
Of course you can do it, but you are thinking in wrong direction. The best you can do is having only one version.
—SA

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.
 
Share this answer
 
Comments
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.
—SA
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.
Sergey Alexandrovich Kryukov 17-Feb-13 0:18am    
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.
—SA
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.

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.

—SA
 
Share this answer
 
Comments
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.
Sergey Alexandrovich Kryukov 17-Feb-13 0:22am    
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.

—SA
Sandeep Mewara 17-Feb-13 0:30am    
Totally agree with SA.
debdeep Bhattacharyya 17-Feb-13 0:28am    
can u suggest some article(easy to understand) that should lead me to light?
Sergey Alexandrovich Kryukov 17-Feb-13 1:13am    
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.

—SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900