||Carlos J. Quintero (Microsoft MVP)
||Microsoft Visual Studio 2005
When using a macro or add-in in VS 2005 to add a non-text file (such as .zip
or .mp3 file) to a solution folder, the file is opened with the associated
This is a bug of Visual Studio 2005.
Steps to reproduce the problem:
- Open Visual Studio 2005 and create a new blank solution.
- Create a new solution folder (NewFolder1).
- Create two files, File1.txt and File1.zip in your documents folder.
- Open the Macros IDE and create this macro:
Dim sMyDocumentsFolder As String
sMyDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
DTE.Solution.Projects.Item(1).ProjectItems.AddFromFile(sMyDocumentsFolder & "\File1.txt")
DTE.Solution.Projects.Item(1).ProjectItems.AddFromFile(sMyDocumentsFolder & "\File1.zip")
- Execute the macro. The File1.txt is added to the solution without
opening it, but the File1.zip file is opened. This also happens with other
files such as .mp3, .doc, etc.
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this