I am trying to generate a Visual Studio 2010 solution and add VS 2010 projects from custom templates!
My requirement: 1. Generate a VisualStudio Solution 2010, Save it to a folder, add VisualSTudio Project from my own templates (I have 3 different templates: ClassLibrary,WinForms ,WCFService)
My issue: I implemented something that is working half a way!
Solution is created correctly but the content of the ".sln" file is very poor! No project reference is added >
In the root folder, it creates a Solution also for the C# Project, which I do not want. I want only the MainSolution file. (In my case "TestSolution.sln"). How can I stop creating a solutionfile for each project created?
Below the source code I use:
//for The solution:
//adding a project
Am I using the wrong interfaces?
Why the vs2010Solution.AddFromTemplate(..)
returns null
after the call, but no exception is thrown? Also the Project is created correctly in the folderstructure! But at runtime I can't check the list of projects "vs2010Solution.Projects" as it is null
! (After correctly adding a project). I need the Project added because I need to add some references programmatically, which I try to do in the next line, but it doesn't work because vs2010Project
is null
).
So I am trying to wrap the VisualStudio 2010 automation model, to create a solution and add projects! But is not really working! Do I need to cast EnvDTE.Project to "VSLangProj.Project" at some point? I want to create a clean wrapper for VS2010, after that one for VS 2012! Any help is much appreciated.