Run dotnet restore in every directory with a .csproj file

Tue, 16 Jun 2020 14:47 UTC by garethbrown

This script searches each folder for the .csproj file, finds that file's parent and runs dotnet restore --no-cache in that directory.

$fileName = '*.csproj'

$searchInFolder = 'C:\Dev\src\a-directory'
Get-ChildItem -Path $searchInFolder -Filter $filename -Recurse | %{$_.FullName} | %{Split-Path $_} | %{Set-Location($_);dotnet restore --no-cache}

Start-Sleep -Seconds 10

The information on this site is provided “AS IS” and without warranties of any kind either
express or implied. To the fullest extent permissible pursuant to applicable laws, the author disclaims all warranties, express or implied, including, but not limited to, implied warranties of merchantability, non-infringement and suitability for a particular purpose.

UI block loader
One moment please ...