Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Registering multiple versions of the same dll

Posted on 2013-06-08
10
Medium Priority
?
551 Views
Last Modified: 2013-06-29
I am trying to have two versions of the same dll running on the same machine, as I described in my last question here. As you can see from that question, I accepted the first answer, which I thought had solved my problem. But as it turned out, I hadn’t tested it out enough. The ‘If’ statement did change the GUID for release, but it didn’t handle a different factor.
      Visual Studio always unregisters the old version of your dll before registering the new one, and it seems to keep track of GUID changes, at least in a limited scope. For example, if you have an assembly that is registered for COM interop, and you change the GUID, Visual Studio knows to unregister the old GUID instead of trying to unregister the new one which obviously hasn’t been registered yet.
      This creates a problem, since I want both versions of the dll to be registered at the same time. I want to compile for debug, then compile for release (while keeping the debug version registered and working) and then go back to compiling for debug (while keeping the release version working). So I need Visual Studio not to unregister the old GUID when the ‘If’ statement changes it.
0
Comment
Question by:BROOKLYN1950
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 83

Expert Comment

by:David Johnson, CD, MVP
ID: 39233614
Either explicitly set the dll path or change the search order
http://stackoverflow.com/questions/2119539/visual-studio-how-to-set-path-to-dll
0
 

Author Comment

by:BROOKLYN1950
ID: 39233758
I’m not sure I understand your answer. The file path of the dll is not the issue I’m running into. By default the dll is compiled to the “…\Debug” directory when compiled for debug, and the “…\Release” directory when compiled for release. I can have both files on the machine at once easily.
      The problem happens when I change the compiler from debug to release. If I compile for debug and then compile for release, Visual Studio removes the debug version from the registry (or wherever the list of COM components is kept). The file is still there, but it doesn’t show up in Excel since it is no longer registered as a COM component.
      The final result I need is to have both versions (debug and release) to show up in the Excel references window at the same time, so I can pick either one (i.e. my Excel file in development uses the debug version, while live and in use Excel file uses the release version).
0
 
LVL 83

Accepted Solution

by:
David Johnson, CD, MVP earned 1500 total points
ID: 39233808
Thanks for expounding on the question.. I don't think you can do this.. The way I'd test it is via a virtual machine..
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 35

Expert Comment

by:sarabande
ID: 39234242
to achieve what you want you need all the registry informations stored to be completely different. all guid's of release and debug have to be different. the names of the dll's can be same as far as they were linked by import library to the executables. if they were used from Excel only the registration as separate COM controls is important.

Sara
0
 

Author Comment

by:BROOKLYN1950
ID: 39238491
The dll will be used only from Excel, when you say a separate COM control, does that mean they have to have different names?
0
 
LVL 35

Expert Comment

by:sarabande
ID: 39241144
i don't know very much of excel. so i can't say whether excel could have the same name for different GUID. but I think, yes, you should add a D suffix to the name of the debug control.

Sara
0
 

Author Comment

by:BROOKLYN1950
ID: 39242962
The problem here doesn't seem to be Excel. I've gotten Excel to use two versions of "the same dll" by making a copy of the project's folder and changing the GUID of copy's assembily. Both assemblies show up in Excel (with the same name but different file paths).
      That is not very workable since I would have to make a new copy of the project and change the GUID in the copy each time I wanted to deploy a new 'live' version. I'm trying to find a way to do it from within the same project.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 39243640
a dll is a file and it is not difficult to using two dlls located in different paths. a COM control has a unique identification in the registry. so you need two controls in registry for your case beside you could put them to a manifest.

debug and release have a different configuration. it is not impossible to define register information for debug and release differently such that you got two controls.

Sara
0
 

Author Comment

by:BROOKLYN1950
ID: 39245153
I'm aware that COM components have unique identifiers in the registry separate from their file paths. That unique identifier is the GUID (Globally Unique Identifier). I can change the GUID for different configurations (as shown in my previous question). I just need to be able to change it without having Visual Studio remove the old one.
      I don't need Visual Studio to do an extra action, I need it not to do an action that it is already doing. Both versions of the dll would work if Visual Studio didn't un-register the old GUID before registering the new one.
0
 

Author Closing Comment

by:BROOKLYN1950
ID: 39287187
After a lot of searching and testing, I decided to use a separate development environment, as it seems that this really can't be done. Oh well...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question