Created
June 19, 2014 06:56
-
-
Save jongalloway/969ca4d2c351c5a37949 to your computer and use it in GitHub Desktop.
Migrate .NET Projects to Automatic Package Restore (recursive) - more information here:https://weblogs.asp.net/jongalloway/scripting-net-project-migration-to-automatic-nuget-package-restore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this automates the steps found here: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore | |
#yes, you could code golf this to about 6 characters if you wanted to | |
$find= @' | |
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> | |
'@ | |
foreach ($f in Get-ChildItem -Recurse -Path ".\" -Filter *.csproj | sort-object) | |
{ | |
$text = Get-Content $f.FullName -Raw | |
$text.Replace($find, "") | set-content $f.FullName | |
} | |
Get-ChildItem .\ -include .nuget,packages -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment