Following examples from here I'm trying to execute
dotnet sln AllProjects.sln add **/*.csproj
But I get this error:
Could not find project or directory
**/*.csproj
.
Looks like wildcards are not working. What am I doing wrong?
Once you have a solution file, you can add a project to it using the sln add command, and provide the path to the project's . csproj file. This will add the project to an existing solution file in the current folder. The path to the project can be absolute or relative, but it will be added as a relative path in the .
One method of adding references to your library is by typing it directly in the project. json file. As you can see that we have added some references under the dependencies section as shown in the following code. Let us now save this file and you will see that references are added to your library now.
Since a solution is a container of projects, it does not make sense for the solution file to be inside the project directory.
I've missed this statement:
Globbing patterns are supported on Unix/Linux based terminals
My Windows PowerShell solution looks like this:
$projects = Get-ChildItem -Recurse | Where-Object { $_.Name -match '^.+\.(csproj|vbproj)$' }
$uniqueProjects = $projects | Group-Object -Property Name | Where Count -EQ 1 | select -ExpandProperty Group | % { $_.FullName }
Invoke-Expression -Command "dotnet new sln -n AllProjects"
$uniqueProjects | % { Invoke-Expression -Command "dotnet sln AllProjects.sln add ""$_""" }
For Windows, open PowerShell and run this command to add all projects to the solution file:
dotnet sln add (ls -r **/*.csproj)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With