Referring to a managed project in another solution

I haven't found a good solution for this on the Web.  Project A in solution 1 wants to call a program in project B in solution 2.  Because project B is in another solution I don't see it on the Project tab of the Add Reference dialog so I add a reference to project B's dll file from the Browse tab.  Once I've done this I can call project B's programs from project A.  The problem is that I'm doing this for the debug build and looking inside the cobol project file the reference is shown as  "debug\ProjectB.dll".  All of our compiled programs are being output to this directory.  When we later do a release build all programs will be output to the release directory and we will need to replace all references.  Because we are keeping our solutions small this could require a lot of work.

What is the best way to add references to projects in other solutions ?

Tags:

  • I use a used "post" and "pre-build" events to copy the .dll into the right location.

    for example:

    In the DLL project have a "post-build" event of:

      if not exist $(SolutionDir)Shared.$(ConfigurationName) mkdir  $(SolutionDir)Shared.$(ConfigurationName)
      copy $(TargetDir)*.dll  $(SolutionDir)Shared.$(ConfigurationName)

     

    and in the exe project have another post build event that copies everything from the directory eg:

      copy $(SolutionDir)Shared.$(ConfigurationName) $(TargetDir)

  • Verified Answer

    I was not able to use the above post build events because my solutions are all in different folders but maybe I won't have a problem after all.  I'm calling a program in managed project b in solution 2 from a program in managed project a in solution 1.  I can't program the call to the program in project b unless I first add a reference to it in project a.  Intellisense can't find it.  Because project b is in a different solution I don't see it on the project tab of the add a reference dialog so I have to browse and select projectb.dll.  For the debug build all of my files are being output to the same "debug" directory, so this directory holds both projecta.dll and projectb.dll.  When I do the release build, projecta.dll and projectb.dll are both output to the same "release" directory.  The reference that I added in project a to project b points to "debug\projectb.dll" not "release.projectb.dll".  When I run the "release" version of my two projects, the program in project a still finds the program in project b.  I also tried renaming the "debug" directory to "debug-save", but the program in project a is still able to call the program in project b.