How to create solution with multiple projects programmatically?

1.9k Views Asked by At

I want to create solution with multiple projects.

I think I have three options:

  1. EnvDTE
  2. Microsoft.Build
  3. Manually create *.sln and *.csproj files

I googled but didn't found good examples for 1 and 2 options (I mean how to create solution, add projects, add refereces, add new or existing project items, etc...)

third option, I think, is easier but if there are good options, I don't need to create projects manually.

So my questions are:

Is there any other options to create projects programmatically?

and Which option is better?

Thanks.

1

There are 1 best solutions below

0
On

Just manually create the sln and csproj files (and other required files) manually, the formats are very simple. You can make this an easy task by creating a new solution with two projects in Visual Studio, and just inspecting the contents of the sln and csproj files. The idea here is that you are just making yourself a template.