Microsoft KB Archive/318165

= &quot;A reference to your project.proj could not be added&quot; error message occurs when you try to add a reference to a project from the project dialog box in Visual Studio .NET =

Article ID: 318165

Article Last Modified on 3/6/2006

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition

-



This article was previously published under Q318165



SYMPTOMS
If you try to add a reference by clicking Browse in the Add Reference dialog box and browsing to a Visual Studio .NET project file, you receive the following error message:

A reference to .proj could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

Note Because there is a Project tab in the Add Reference dialog box, you may think that you can add a &quot;project&quot; file; however, you can only add a &quot;project&quot; reference if you first add the project to your solution. Neither the documentation nor the error message explains this fact.



RESOLUTION
To resolve this issue, add a project reference by following these steps:
 * 1) In the Solution Explorer, right-click the solution, and then click Add and Existing Project.
 * 2) Browse to the project file that you want to add, and then click Open.
 * 3) In the Solution Explorer, right-click your original project name, and then click Add Reference. Click the Project tab.
 * 4) Select the project that you added to the solution, click Open, and then click OK.

Note These steps work only if the output type of the project that is being referenced is a .dll file. You cannot reference .exe files.



STATUS
This behavior is by design.



Steps to reproduce behavior
 In Visual Studio .NET, create a Microsoft Visual C# Windows Application. In the Solution Explorer, right-click the project name, and then click Add Reference. Click the Project tab. Click Browse, change Files of Type to All, and then select a project file. Click Open and then click OK. You receive the following error message:

A reference to .proj could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessible, and that it is a valid assembly or COM component.



Keywords: kberrmsg kbtshoot kbprb kbvs2005swept kbvs2005doesnotapply KB318165

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.