Macro projects are saved when you run or build a project in Visual Studio 2005 or in Visual Studio .NET (840922)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 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
  • 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

In Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, when you open the Microsoft Visual Studio Macros editor, you may notice that the changes that you made earlier to a macro project are saved although you did not explicitly save the changes.

CAUSE

This behavior occurs because the Save changes to open documents only option is selected. This behavior is the default behavior.

Note The Save changes to open documents only option is located under Build and Run Options in the Options dialog box in Visual Studio 2005 or in Visual Studio .NET.

WORKAROUND

To work around this behavior, follow these steps:
  1. Start Visual Studio 2005 or Visual Studio .NET.
  2. On the Tools menu, click Options. The Options dialog box appears.
  3. Double-click Environment, and then click Projects and Solutions.
  4. Under Build and Run Options in the right pane of the Options dialog box, select Prompt to save changes to open documents or select Don't save changes to open documents.
  5. Click OK.
  6. On the File menu, click Exit to quit Visual Studio 2005 or Visual Studio .NET. The Save changes to the following items dialog box appears.
  7. Do one of the following:
    • If you want to save the macro that you created, you click Yes.
    • If you want to exit Visual Studio 2005 or Visual Studio .NET without saving the macro that you created, you click No.

MORE INFORMATION

Steps to reproduce the behavior

  1. Start Visual Studio 2005 or Visual Studio .NET.
  2. On the File menu, point to New, and then click Project. The New Project dialog box appears.
  3. Under Project Types, click Visual Basic Projects.

    Note In Visual Studio 2005, Visual Basic Projects is changed to Visual Basic.
  4. Under Templates, click Console Application.
  5. Click OK. By default, a module that is named Module1.vb is added to the ConsoleApplication1 project.
  6. In the Module1 module, replace the existing code with the following code:
    Module Module1
    
        Sub Main()
            Console.WriteLine("Start Testing")
            Console.ReadLine()
        End Sub
    
    End Module
  7. On the Tools menu, point to Macros, and then click Macros IDE. The Microsoft Visual Studio Macros editor appears.
  8. On the View menu, click Project Explorer.
  9. In Project Explorer, expand MyMacros, and then double-click Module1. The code view of the Module1 module appears.
  10. In Module1 module, replace the existing code with the following code:
    Imports EnvDTE
    Imports System.Diagnostics
    
    Public Module Module1
        Sub Test()
            Dim a As Integer
            Dim b As Integer
            Dim c As Integer
            c = a + b 
        End Sub
    End Module
  11. Switch to the instance of Visual Studio 2005 or of Visual Studio .NET where the ConsoleApplication1 project is open.
  12. On the Build menu, click Build Solution.
  13. On the File menu, click Exit to quit Visual Studio 2005 or Visual Studio .NET. Notice that the Microsoft Visual Studio editor closes also.
  14. Start Visual Studio 2005 or Visual Studio .NET.
  15. Open the Microsoft Visual Studio Macros editor. Notice that the changes that you made to the macro in step 10 exist. Also, notice that the changes exist in the new Microsoft Visual Studio Macros editor.

Modification Type:MajorLast Reviewed:3/3/2006
Keywords:kbvs2005swept kbvs2005applies kbmacro kbprb KB840922 kbAudDeveloper