BUG: You receive an "Interface not registered" error message when you try to retrieve the References collection for a VSProject object (840928)



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

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:
    • Microsoft Windows 2000
      In Control Panel, double-click the Add/Remove Programs icon. The Add/Remove Programs dialog box appears.
    • 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.
  2. In the list of programs, click the Visual Studio .NET 2003 program, and then click Change/Remove.
  3. In the Microsoft Visual Studio .NET Setup dialog box, click Visual Studio .NET.
  4. 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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the behavior

  1. Install Visual Studio .NET 2002 on your computer.
  2. Install Visual Studio .NET 2003.
  3. After the installation process is complete, remove Visual Studio .NET 2002.
  4. Start Visual Studio .NET 2003.
  5. On the View menu, point to Other Windows, and then click Macro Explorer.
  6. In Macro Explorer, right-click Macros, and then click New Macro Project. The New Macro Project dialog box appears.
  7. In the Name box, type ReferencesObject, and then click Open.
  8. Under the ReferencesObject node in Macro Explorer, double-click the Module1 node. The code editor of the Module1 module opens.
  9. 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
    
  10. On the File menu of the Macros IDE, click Save ReferencesObject.
  11. On the File menu of the Macros IDE, click Close and Return.
  12. On the File menu of Visual Studio .NET, point to New, and then click Project. The New Project dialog box appears.
  13. Under Project Types, click Visual Basic Projects, and then click Windows Application under Templates.
  14. In the Name box, type MyApplication, and then click OK.
  15. In Macro Explorer, right-click the References node, and then click Run.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:

Modification Type:MinorLast Reviewed:3/7/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbmacro kberrmsg kbsetup kbenv kbbug KB840928 kbAudDeveloper