Visual C# Express 'Include' libraries

J

JohnGoogle

Hi,

Is it possible in Visual C# Express to reference source files from a
folder other than the current project folder? I want to have a common
folder with various cs source files and be able to reference the files
from different projects. This will allow me to edit them as I develop
projects. Or do you have to compile the common code into a DLL or EXE
and reference them that way?

Thanks.

John.
 
N

Nicholas Paldino [.NET/C# MVP]

John,

I don't know if you are able to use Express to compile dll libraries.
If not, then I would recommend compiling your classes into a library using
the command line compiler (look for information on CSC.exe) or, find a
project file for a dll library and modify it to use your files, and then use
MSBUILD to build it (the preferred method, it will make things much easier).

Then, you can reference your dll from your EXE project.

Hope this helps.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Yes you can, select add an existing item and then instead of add click on
the little arrow and select link.

IMO this is not a good idea though . you can make changes from one project
to that file that can break other projects.
It's much better if you create a library project and then the others
projects just add a reference to it.
 
J

JohnGoogle

Ignacio,

Thanks for that tip re: the Add Link. That works a treat. I accept what
you say about the dangers but I was just wanting to do it this way for
the initial development and testing and didn't want to keep compiling a
DLL each time I wanted to make changes in the common code. The projects
I was referring to were just test projects anyway to help develop the
code.

John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top