Add Class Library Reference to another Project in Visual Studio 2012 Solution
To add class library as a reference to an existing project in Visual Studio 2012 solution, Visual Studio programmers can use Reference Manager.
If main project is a Windows Phone 8 app project then the class library must be a Windows Phone class library project.
This Visual Studio tutorial show how to add class library as a reference to other projects in the same solution using Reference Manager.
Also the error is displayed caused by using a Class Library template instead of using Windows Phone Class Library that is installed with Windows Phone SDK 8.0 on Visual Studio 2012.
This type of class library projects can not be referenced in Windows Phone projects.
Assume that you have two projects in your Visual Studio 2012 solution.
One of the projects is a Class Library and the other project can be a Windows Form project or a Windows Phone app project.
Look at the below VS2012 solution structure where a class library QuotesClassLibrary and a Windows Phone 8 app project named TimeManagementQuotes can be seen.
Now within the Time Management Quotes app project, I want to use Quotes and Quote classes defined in the Quotes ClassLibrary.
Open project properties.
Go to References tab.
Visual Studio 2012 main project references to Class Library project
Click "Add" button then choose "Reference" option as seen in below Visual Studio project properties screenshot.
Add reference to an existing project in Visual Studio 2012 solution
When Visual Studio 2012 Reference Manager is opened, in Solutions tab choose the target class library project to add as a reference to your Windows Phone app project.
Mark the checkbox and then press OK button.
If the ClassLibrary is added successfully as a reference to the main project or the Windows Phone project then you will see the reference name in the References table.
Reference added successfully
If you tried to use an existing Class Library that was created using from a Windows Class Library project template, you won't be able to reference this class library in Windows Phone 8 app projects.
Although you can add a Windows Phone project and a Windows Class Library project in the same solution, when you try to add class library as a reference to the Windows Phone project, you will get the following Visual Studio error.
Visual Studio error: Reference must be a Windows Phone project
Microsoft Visual Studio
Unable to add the specified project reference. The reference must be a Windows Phone project that targets the current or earlier version of the Windows Phone OS.
The solution is easy. You must create a new class library using Windows Phone Class Library project template.
Only a Windows Phone Class Library can be referenced by a Windows Phone 8 app project.