I am using Visual Basic Express (May release) and I am trying to create a
solution programatically. How do I do this? I know I need to use the
AddFromTemplate but how do I determine the path to the template that I want
to use, let's say the template is the "winfxapplication" template, which on
my machine is
"C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\VBExpress\ProjectTemplatesCache\1033\WindowsApplication.zip\windowsapplication.vstemplate"
Or do I point it at the .vbproj file:
"C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\VBExpress\ProjectTemplatesCache\1033\WindowsApplication.zip\windowsapplication.vbproj"
I'm assuming there are just a few lines of code required. First of all, I
want to create a VS2005 object. I have tried:
Dim env As EnvDTE80.DTE2 =
CType(Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.8.0",
""), EnvDTE80.DTE2)
but that tells me it cannot create the ActiveX object. I then tried:
Dim env As EnvDTE.DTE =
CType(Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.7.1",
""), EnvDTE.DTE)
and that creates the object, so when I do this:
ENV.Solution.ADDFromTemplate("C:\Program Files\Microsoft Visual Studio
8\Common7\IDE\VBExpress\ProjectTemplatesCache\1033\WinFXApplication.zip\WinFXApplication.vbproj",
"e:\mytests", "myproject.vbproj")
I get the message "The file blah blah is not a valid project file. The
project file is missing the 'VisualStudioProject' section." whatever that
means.
I think I am on the right track here, can anybody out there just straighten
me out on this? I am starting to tear my hair out.
Thanks in advance,
Richard