Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya
 asked on

Use class from different Project and Solution

Hello Experts,
I have a Class A in Project A.  I have a Project B too.  Project B would like to use some methods from Class A.  How can I do that.

Note: I am using ASP.NET and C# in Visual Studio 2015

Thank you!
.NET ProgrammingC#Microsoft Visual Studio

Avatar of undefined
Last Comment
RadhaKrishnaKiJaya

8/22/2022 - Mon
John Tsioumpris

In Project B you use Project A as Reference
Éric Moreau

Project A has to be of type "class library. Then in Project B, add a reference to Project A and it will be available.
RadhaKrishnaKiJaya

ASKER
Thank you John Tsioumpris for your quick reply.

I forgot to mention that, they have different solutions too.  Please let me know.

Thank you!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Éric Moreau

A solution is a group of projects. A project can be added to multiple solutions.

If you don't need to debug your classes of ProjectA while working in Project B, you can add a reference to the compiled DLL of project A.
Éric Moreau

RadhaKrishnaKiJaya

ASKER
Thank you Éric,
I am looking at it and update here soon.

Thank you!
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
RadhaKrishnaKiJaya

ASKER
Eric,
1. I need to Debug the code once the Reference is added.  How can I do that?  Is there an alternative way?

2. The Add Reference is missing from Solution Explorer when I right click it.  I can see it when I right click on Projects --> Add --> Reference.  Not sure if this is the right way.

Please let me know if I am missing anything.

Thank you!
ASKER CERTIFIED SOLUTION
Éric Moreau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RadhaKrishnaKiJaya

ASKER
Thank you Eric for your timely help.