Who Needs VB.NET Macros?
Prototyping addins can be frustrating. If you don't fancy learning VB.NET just to write macros, you're forced to work with a full blown addin. This is anoying if all you want is a quick spelunk inside the VS automation model. This is why I've added another test target. If you select 'Run With... VS.NET', your tests will run inside the current VS.NET process. I've made the DTE object accessable using AppDomain.Current.GetData("DTE").
The following code will list all documents open inside the current instance of VS. Just make sure you select 'Run With... VS.NET'. Have fun...
You can download the latest version here. There's now a new releases rss feed!using
System;using
System.Diagnostics;using
EnvDTE;
public
class TestDTE{
public void TestDocuments(){
_DTE dte = (_DTE)AppDomain.CurrentDomain.GetData("DTE");
Documents documents = dte.Documents;
for(int count = 0 ; count < documents.Count ; count++){
Document document = documents.Item(count + 1);
Debug.WriteLine(document.FullName);
}
}
}