.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.

Who is Participating?
Snarf0001Connect With a Mentor Commented:
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.
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.)
Snarf0001Connect With a Mentor Commented:
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.
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Just re-reading that response, I realize I did a really horrible job explaining that.
Let me know if it wasn't clear.
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"?

rmmarshAuthor Commented:
Thank you... sorry for the delay in awarding points.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.