Link to home
Create AccountLog in
Avatar of 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!
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

In Project B you use Project A as Reference
Project A has to be of type "class library. Then in Project B, add a reference to Project A and it will be available.
Avatar of RadhaKrishnaKiJaya


Thank you John Tsioumpris for your quick reply.

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

Thank you!
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.
Thank you Éric,
I am looking at it and update here soon.

Thank you!
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!
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thank you Eric for your timely help.