Microsoft KB Archive/840928

= BUG: You receive an &quot;Interface not registered&quot; error message when you try to retrieve the References collection for a VSProject object =

Article ID: 840928

Article Last Modified on 5/18/2007

-

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

-





SYMPTOMS
You install Microsoft Visual Studio .NET 2002 and Microsoft Visual Studio .NET 2003 on your computer, and then you remove Visual Studio .NET 2002. If you create a macro that retrieves the References collection for a project by using the VSProject object, and then you run the macro, you receive the following error message:

Interface not registered



CAUSE
This error occurs when you remove Visual Studio .NET 2002 from your computer. When you do this, the References interface in the VSLangProj library is unregistered.



WORKAROUND
To work around this problem, repair or reinstall Visual Studio .NET 2003. To do this, follow these steps:
 * 1) Do one of the following, depending on your operating system:
 * 2) * Microsoft Windows 2000

In Control Panel, double-click the Add/Remove Programs icon. The Add/Remove Programs dialog box appears.
 * 1) * Microsoft Windows XP or Microsoft Windows Server 2003

In Control Panel, double-click the Add or Remove Programs icon. The Add or Remove Programs dialog box appears.
 * 1) In the list of programs, click the Visual Studio .NET 2003 program, and then click Change/Remove.
 * 2) In the Microsoft Visual Studio .NET Setup dialog box, click Visual Studio .NET.
 * 3) In the Microsoft Visual Studio .NET Maintenance dialog box, click Repair/Reinstall.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior
 Install Visual Studio .NET 2002 on your computer. Install Visual Studio .NET 2003. After the installation process is complete, remove Visual Studio .NET 2002. Start Visual Studio .NET 2003. On the View menu, point to Other Windows, and then click Macro Explorer.</li> In Macro Explorer, right-click Macros, and then click New Macro Project. The New Macro Project dialog box appears.</li> In the Name box, type ReferencesObject, and then click Open.</li> Under the ReferencesObject node in Macro Explorer, double-click the Module1 node. The code editor of the Module1 module opens.</li>  In the Module1 module, replace the existing code with the following code: Imports VSLangProj Imports EnvDTE Imports System.Diagnostics Public Module Module1 Sub References 'Retrieve the VSProject object. Dim proj As Project = DTE.Solution.Projects.Item(1) Dim vsproj As VSProject = CType(proj.Object, VSProject) 'Retrieve the References collection for the project. Dim ref As References = vsproj.References 'Display the name of the project. MsgBox(ref.ContainingProject.Name) End Sub End Module </li> On the File menu of the Macros IDE, click Save ReferencesObject.</li> On the File menu of the Macros IDE, click Close and Return.</li> On the File menu of Visual Studio .NET, point to New, and then click Project. The New Project dialog box appears.</li> Under Project Types, click Visual Basic Projects, and then click Windows Application under Templates.</li> In the Name box, type MyApplication, and then click OK.</li> In Macro Explorer, right-click the References node, and then click Run.</li></ol>

<div class="references_section">