[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

.dll creation in solution

I have a solution with 2 projects in it; I'm using VS 2008 C#.  Is it possible to have one of the projects in the solution created as a .dll while the other (main project) is an .exe file with the previously mentioned .dll included?

If so, please give me the steps, or point to some docs.

Thanks...
0
rmmarsh
Asked:
rmmarsh
  • 3
  • 3
2 Solutions
 
Snarf0001Commented:
If the projects are already created (specifically the one you want as a dll) it may be tricky.
If you were starting from scratch:

Create new project (Windows Forms Application)

Right click on the solution in the solution explorer, and Add -> New Project (of type "Class Library") which will create the dll app

Right click the PROJECT you created in step one, and go to Add Reference
Click the "Projects" tab, and the dll proj you created in step 2 should appear.

Select that one, and the dll will automatically be added.  All builds / debug / release versions will be in sync with each other as you build the solution.
0
 
rmmarshAuthor Commented:
OK... got that far on my own... now the question is:  is it possible for the .dll to reference objects in the .exe file?  If so, how?  (I've tried all kinds of stuff, like passing the mainForm to the .dll, but it doesn't find the objects.)
0
 
Snarf0001Commented:
So you want to reference functions / objects in the dll from the exe, AND reference functions / objects from the exe in the dll?

With 2 projects you can't do that, as it would create a circular dependancy, but one way around would be to create a 3rd dll project, which contained Interfaces to the objects or functions you want to call.

In both other projects, you can inherit the 3rd dll, and have the shared objects implement those interfaces.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Snarf0001Commented:
Just re-reading that response, I realize I did a really horrible job explaining that.
Let me know if it wasn't clear.
0
 
rmmarshAuthor Commented:
What I'm trying to do is break up this hugh (700 M) program into parts (one .exe and several .dlls) where the dlls are infrequently used.  Unfortunately, I need to have the .dll <--> .exe references, because that's the way it was originally written.  Was there a better way to write it?  (the .dll needs to reference some objects in the .exe like the database connection, but I can re-write that).  I guess the major question is:  can and how can the .dll reference objects in the main form?  or if they are re-written, what do I have to look out for (ie. do they have to "stand-alone"?

HTH
0
 
rmmarshAuthor Commented:
Thank you... sorry for the delay in awarding points.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now