Reputation: 1151
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?
Upvotes: 4
Views: 3094
Reputation: 1151
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");
Upvotes: 4
Reputation: 606
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++?
Upvotes: 0