Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a class from another project in Visual Studio 2013 Ultimate

I am completely new to using Visual Studio 2013 Ultimate and C# and I am trying to figure out how to simply import a class that exists in another project into my console application.

I have another project named Project1 that contains a CreditCard.cs file. I have tried the following for importing the CreditCard class:

  • typing using Project1.CreditCard
  • going to the Solution Explorer and then looking for "References" which I could not find, to try to include the class as an imported class.

Can anyone please point me in the right direction or tell me how I might import a class in C#?

like image 789
Chizx Avatar asked Oct 04 '14 04:10

Chizx


People also ask

How do I import a project into Visual Studio 2013?

File>New>Project From Existing Code... Choose Visual C++ then click Next. Set Project File Location to something OTHER than C:\Users*yourUserName*\Documents\Visual Studio 2013\Projects. Use the Add button to add the source tree.


1 Answers

You right click on the project (not solution) that you want having the reference. So click on your new project, choose Add | References --- then in the dialog, choose Solution on the left, and find your CreditCard project and add it. It'll add the reference, and you can then use the Using in your code.

like image 103
Jason Avatar answered Sep 25 '22 22:09

Jason