how to create a sln file

HI,
I found the solution..
here is the code

Imports EnvDTE
Imports EnvDTE80
-----------------------------------------------------------------------------------
    Private Shared Sub DoStuff()

        Dim filePath As String = "c:/temp"

        Dim fileName As String = "bld_TestApp.sln"

        Dim fullName As String = Path.Combine(filePath, fileName)

        Dim objType As Type

        Dim objDTE As EnvDTE.DTE

        'Creates an instance of the Visual Studio .NET 2005 IDE

        objType = Type.GetTypeFromProgID("VisualStudio.DTE.8.0")

        objDTE = DirectCast(System.Activator.CreateInstance(objType), EnvDTE.DTE)

        Console.WriteLine(objDTE.Name + ":" + objDTE.Version)


        objDTE.Solution.Create(filePath, fileName)

        objDTE.Solution.AddFromFile("C:/Common.vbproj")

        objDTE.Solution.SaveAs(fullName)


    End Sub
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章