Create empty solution files for VS2010 programmatically?

I am trying to create an empty solution file for Visual Studio 2010, but cannot do this?

We used to create an empty solution file for vs2008 using EnvDTE :: _ SolutionPtr ptrSoln (_T ("VisualStudio.Solution.9.0")); but I can not find the equivalent for VS2010.

I was able to find how to create a project, but not solutions?

+4
source share
2 answers

I have found the answer. The answer lies with the previous question I mentioned - How can I create a new blank solution in the 2008 version?

I forgot to add a link to EnvDTE, EnvDTE80. EnvDTE90 and EnvDTE100. Also the name of the solution class is Solution4 instead of Solution3. So, a piece of code that works:

string visualStudioProgID = "VisualStudio.Solution.10.0"; Type solutionObjectType = System.Type.GetTypeFromProgID(visualStudioProgID, true); object obj = System.Activator.CreateInstance(solutionObjectType, true); Solution4 solutionObject = (Solution4)obj; solutionObject.Create("C:/", "Test"); solutionObject.SaveAs(@"C:/Test.sln"); 
+4
source

Not 100% sure what you are asking. If you just need an empty solution with some pre-created folders that will be a file called yourProject.sln, go to any main language that you installed (C ++ in my case) and create an empty project. This will give you an empty solution file in which there will be only one folder, it will be called yourProject in my case above and several project files related to the language. If you want to add a new project to this solution, go to: File-> Add-> New Project. Complete the rest with any type of application your project / program should have. This is how it is done in C ++, I don’t know how to do it, say, C #. However, you did not specify the language ... So, I'm not sure where to go to help you, Visual Basic? C ++?

0
source

All Articles