"A reference to your project.proj could not be added" error message occurs when you try to add a reference to a project from the project dialog box in Visual Studio .NET (318165)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • 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 your project.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 "project" file; however, you can only add a "project" 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.

MORE INFORMATION

Steps to reproduce behavior

  1. In Visual Studio .NET, create a Microsoft Visual C# Windows Application.
  2. In the Solution Explorer, right-click the project name, and then click Add Reference. Click the Project tab.
  3. 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 your project.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.

Modification Type:MinorLast Reviewed:3/6/2006
Keywords:kbvs2005doesnotapply kbvs2005swept kbtshoot kberrmsg kbprb KB318165 kbAudDeveloper