How to use a class from one C# project with another C# project
Solution 1:
- In the 'Solution Explorer' tree, expand the P2 project, right-click (Shift+F10) the 'Dependencies' node and select 'Add Project Reference...'.
- On the 'Add Reference' dialog, select your P1 project.
- If you are using namespaces then you will need to import the namespaces for your P1 types by adding 'using' statements to your files in P2.
Note that the types in P1 that you wish to access directly must have a sufficient access level: typically this means they must be made public.
Note: If you are working on an older project (e.g. .NET Framework) you may not have the 'Dependencies' node. In which case right-click the project and select 'Add Reference' from the menu and then ensure the 'Projects' tab is selected on the left.
Solution 2:
Simply add reference to P1 from P2