Sdk: Introduce a way to create a solution file

Created on 10 Jan 2017  路  12Comments  路  Source: dotnet/sdk

Approved to merge Area-External In PR release blocking

Most helpful comment

dotnet sln create. It should behave as such:

  1. Drop the SLN file named like the folder being dropped in.
  2. Glob all of the proj-es in the directories beneath it.
  3. If they exist, add them.
  4. If not, exit.

Thoughts?

All 12 comments

dotnet new -t sln?

dotnet sln create. It should behave as such:

  1. Drop the SLN file named like the folder being dropped in.
  2. Glob all of the proj-es in the directories beneath it.
  3. If they exist, add them.
  4. If not, exit.

Thoughts?

I'd probably not add all projects by default.
dotnet sln add **/*.*proj should be the way to go.
Maybe even dotnet sln create New.sln **/*.*proj? (Making it figure out that if you don't pass a .sln as first arg, the next ones are already projects to add)

I'm definitely all for this. I like @blackdwarf's suggestion and @dasMulli's refinement quite a bit.

So we currently don't really support globbing as a parameter in any other CLI command. I would not like to introduce it here simply because I think it would require some more thought as to how it applies to other commands etc.

So the question remains, should then the first turn of the crank of dotnet sln create simply put down a valid SLN file and then later be enhanced or should we add the ability to get all of the projects in the dirs underneath the one where the command is invoked?

I would vote for option dotnet/sdk#4283 due to the time pressure.

@blackdwarf in my example, the globs are evaluated by the user's shell. I think it already works with dotnet sln add.

@dasMulli interestingly enough, I can repro this on bash but cannot do it on PowerShell no matter what kind of glob I put in. Could it be specific to bash?

For 1.0.0 this will be handled via a template that will come in as part of dotnet new3. @mlorbetske is that new template in place yet?

The template is in place in the version that will get picked up by the new3 cutover

@blackdwarf I think the default behaviour should be just to create the solution file ("first turn of the crank"), with the option to then add project files via a switch. So:

dotnet sln create <solution-filename>

would drop a valid sln in the containing folder with the given name (or, default to the folder name). It should be able to handle <solution-filename> with and without the .sln extension.

dotnet sln create <solution-filename> --add-projects

would do the above and also discover and add all project files below the containing folder.

Globbing functionality can be added later, but personally I think the above would cater for 90% of all cases.

Fixed by dotnet/cli#5430

For anyone wondering, you can create a solution file using dotnet new sln [-n <name>].

Was this page helpful?
0 / 5 - 0 ratings