Blog Stats
  • Posts - 52
  • Articles - 0
  • Comments - 1
  • Trackbacks - 12

 

Creating a VS2005 instance

Sometimes is very usefull for testing purposes to create a VS2005 instance, and them use that instance to have access to the DTE API stuff.

So, here is a code snippet to create a VS2005 instance and to open a solution:

            Type t = Type.GetTypeFromProgID("VisualStudio.DTE.8.0");

            DTE dte = (DTE)System.Activator.CreateInstance(t, true);

            try
            {
                dte.Solution.Open(@"C:\Temp\Temp.sln");

                //Wait some seconds to let VS open the solution
                System.Threading.Thread.Sleep(5000);
            }
            finally
            {
                dte.Solution.Close(false);
            }

Pablo


Feedback

No comments posted yet.


Post a comment





 

 

 

Copyright © Pablo Galiano