Add dotnet add|list|remove project commands for solution files
See original GitHub issueThe CLI needs to provide a way for users to manipulate the solution file (SLN file).
Below is a mini-spec of the command.
Usage
`dotnet add <project_or_solution> project <project>
Top level Verbs
add
list
remove
Arguments
- <project_or_solution>
- A project or a solution path
- <project>
- Path to the project file to include in the SLN file. Has to be a relative path.
Defaults
- If the <project> is not present, we will try to see if there is a project in the current directory; if there is, it will be added, if not, an error is displayed
- If the <project_or_solution> is not present, we will check the current directory for either a project file or a sln file.
- If neither are found, an error is displayed
- If more than one is found or if there is both sln and a project file present, an error is displayed prompting the user to specify which file the operation should work on.
Notes
- This command adds a project to a solution if it works on an SLN file. In case a project file, it will add a
<ProjectReference>
to the project in question. - The command will make absolute paths of the project being added relative to the solution file/project being added. This is done to avoid messy breaks when moving machines.
Examples
dotnet add project "../path/to/project.csproj"
- Add a project found at the specified path to the solution file
dotnet remove project "../path/to/project.csproj"
- Remove a project found at the specified path to the solution file
dotnet list path/to/solution.sln project
- List out all of the projects and configurations from the solution;
Issue Analytics
- State:
- Created 7 years ago
- Reactions:10
- Comments:19 (6 by maintainers)
Top Results From Across the Web
dotnet sln command - .NET CLI
The dotnet-sln command provides a convenient option to add, remove, and list projects in a solution file.
Read more >.net - How to add a Project (.csproj) to Solution (.sln) under ...
Please try below code to add project to a solution from projects sub folder dotnet sln ../todo.sln add todo-app.csproj.
Read more >Creating and editing solution files with the .NET CLI
In this post, I show how to manage sln files with the .NET command line interface (CLI). See how to create sln files,...
Read more >Add All Projects to Solution with dotnet CLI | Blog
This will recursively find .csproj files in any subfolder and will add them to the solution using the dotnet sln add command. With...
Read more >How to Create a new Solution and Projects using dotnet CLI
I create a lot of samples, demos, open source projects, etc. and I like to use the fairly standard repository layout of having...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sayedihashimi
I think it’s important if only so that there is feature parity across platforms. We can do this in VS proper, so the expectation is that the
dotnet sln
command should be able to do it, too.This is exactly the scenario I was thinking of, so I am certain that having it in
dotnet sln
would be appreciated by many.@shaunluttin just answered your stack overflow question http://stackoverflow.com/questions/40387332/add-a-project-json-based-project-to-a-sln-file-without-using-visual-studio/42735746#42735746