How to use classes in another project ?

  • Thread starter Thread starter lodhaakhil85
  • Start date Start date
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
 
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
 
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 ??
 
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
 
Back
Top