How to use classes in another project ?

L

lodhaakhil85

Hi,

I have added another project to my solution and would like to create
objects of the classes defined in the second project. How can this be
done ?? How can I reference the namespaces etc ??

Thanks,
Akhil
 
A

Andrew Faust

Hi,

I have added another project to my solution and would like to create
objects of the classes defined in the second project. How can this be
done ?? How can I reference the namespaces etc ??

Right click on references in the project view and choose add reference,
select the tab that says Projects and choose the project you just added
to the solution.

Andrew Faust
 
L

lodhaakhil85

Hi Andrew,

Thank you for your reply but when I used your idea, selected the
project to be added I got an error saying that A reference to the
project cannot be added as An assembly must have a dll extension in
order to be referenced.

Is there any other way ??
 
A

Andrew Faust

Hi Andrew,

Thank you for your reply but when I used your idea, selected the
project to be added I got an error saying that A reference to the
project cannot be added as An assembly must have a dll extension in
order to be referenced.

Is there any other way ??

I assumed your other project was a DLL project, as that's the standard
way to share classes amongst different apps.

You could change the other application type to a dll in the project
properties. However, the preferred method is to take the classes that
need to be shared and put them in their own dll project, then have both
your other applications reference that dll.

Andrew Faust
 

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