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?

1
  • 1
    Found the answer. Posted in answers section. Commented May 27, 2011 at 15:09

2 Answers 2

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");
Sign up to request clarification or add additional context in comments.

Comments

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++?

2 Comments

Sorry if this has caused any confusion?
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 stackoverflow.com/questions/5037995/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.