-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_sln.ps1
35 lines (26 loc) · 1021 Bytes
/
create_sln.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# using namespace System.IO
# $a = Get-Command bash.exe
# if ($null -eq $a) {
# Write-Error "Install wsl first."
# exit
# }
# # bash.exe -c "tree -fi -P '*.csproj' -I 'bin|obj|debug|release|.vscode|.vs|.ionide' | grep 'csproj' > paths"
# # bash.exe -c "tree -dfi --noreport -I 'bin|obj|debug|release|.vscode|.vs|.ionide' > paths"
# wsl -- "tree" "-fi" "-P" "'*.csproj'" "-I" "'bin|obj|debug|release|.vscode|.vs|.ionide'" | findstr csproj > paths
# if (-not (Test-Path paths) ) {
# Write-Error "Install tree in wsl first."
# exit
# }
# $paths = [File]::ReadAllLines("paths")
# if ($paths.Count -gt 0) {
# dotnet new sln --force
# }
# dotnet.exe sln add $paths
# # for ($i = 0; $i -lt $paths.Count; $i++) {
# # $cmd = "dotnet sln add " + $paths[$i];
# # Invoke-Expression $cmd
# # }
# Remove-Item paths
# https://docs.microsoft.com/zh-cn/dotnet/core/tools/dotnet-sln#examples
dotnet.exe new sln --force
dotnet.exe sln add (Get-ChildItem -r **/*.csproj)