4

I am trying to create empty solution file for Visual studio 2010 but I am unable to do so?

We used to create empty solution file for vs2008 by EnvDTE::_SolutionPtr ptrSoln(_T("VisualStudio.Solution.9.0")); but I am unable to find equivalent for VS2010.

I was able to find how to create project but not Solutions?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Atul
  • 1,116
  • 1
  • 10
  • 20

2 Answers2

4

I found the answer. Answer lies in previous question mentioned by me - How can I create new blank solution in vs 2008 programmatically?

I forgot to add reference to EnvDTE, EnvDTE80. EnvDTE90 and EnvDTE100 assembly. Also name of solution class is Solution4 instead of Solution3. So code snippet which works is:

 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");
Community
  • 1
  • 1
Atul
  • 1,116
  • 1
  • 10
  • 20
0

Not 100% sure what you're asking. If you just want an empty solution with some pre-created folders, which would be a file just named yourProject.sln, go to whatever primary language you have installed (C++ in my case), and make an empty project. This will give you an empty solution file, with just one folder, it would be named yourProject in my case above, and a few project files related to the language. If you want to add a new project to this solution, go to: File->Add->New Project. Fill in the rest with whatever application type your project/program needs to be. This is how it's done in C++, I don't know how to do it in, say C#. However, you didn't specify a language... So I'm not sure where to go to help you, Visual Basic? C++?

hjc1710
  • 576
  • 4
  • 17
  • Sorry if this has caused any confusion? – Atul May 27 '11 at 15:02
  • I know how to do it using IDE (devenv). I wanted to write a command line utility to do that. e.g. this is existing question for vs2008 http://stackoverflow.com/questions/5037995/how-can-i-create-new-blank-solution-in-vs-2008-programmatically – Atul May 27 '11 at 15:03