From 6da8daad8981d26bf91064a89225e9a2eae6c860 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 21 Nov 2019 21:30:22 -0500 Subject: [PATCH 1/2] Add a script for generating a .sln containing all library projects --- src/libraries/GenerateLibrariesSln.ps1 | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/libraries/GenerateLibrariesSln.ps1 diff --git a/src/libraries/GenerateLibrariesSln.ps1 b/src/libraries/GenerateLibrariesSln.ps1 new file mode 100644 index 00000000000000..6a1b5409048bde --- /dev/null +++ b/src/libraries/GenerateLibrariesSln.ps1 @@ -0,0 +1,32 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# See the LICENSE file in the project root for more information. + +# Creates a .sln that includes all of the library src, ref, or test projects. + +param ( + [string]$type = "src" +) + +$SolutionName = "Libraries." $($type) ".Generated.sln" + +# Delete the existing solution if it exists +if (Test-Path $SolutionName) +{ + Remove-Item $SolutionName +} + +# Create the new solution +dotnet new sln --name $([System.IO.Path]::GetFileNameWithoutExtension($SolutionName)) + +# Populate it with all *\src\*.csproj projects +foreach ($f in Get-ChildItem -Path $([System.IO.Path]::Combine("*", $type, "*")) -Filter *.csproj) +{ + dotnet sln $SolutionName add --in-root $f.FullName +} + +if ($type -eq "src") +{ + # Also add CoreLib if this is for src projects + dotnet sln $SolutionName add --in-root $f.FullName $([System.IO.Path]::Combine("..", "coreclr", "src", "System.Private.CoreLib", "System.Private.CoreLib.csproj")) +} From 090ae5f5c5571a8787900fd5bb135c75af230c58 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 21 Nov 2019 21:47:52 -0500 Subject: [PATCH 2/2] Add a script for generating a .sln containing all library projects --- src/libraries/GenerateLibrariesSln.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/libraries/GenerateLibrariesSln.ps1 b/src/libraries/GenerateLibrariesSln.ps1 index 6a1b5409048bde..387d971593adcf 100644 --- a/src/libraries/GenerateLibrariesSln.ps1 +++ b/src/libraries/GenerateLibrariesSln.ps1 @@ -2,13 +2,21 @@ # The .NET Foundation licenses this file to you under the MIT license. # See the LICENSE file in the project root for more information. -# Creates a .sln that includes all of the library src, ref, or test projects. +# Creates a .sln that includes all of the library src, ref, or tests projects. param ( - [string]$type = "src" + [string]$type = "src" # can also be "ref" or "tests" ) -$SolutionName = "Libraries." $($type) ".Generated.sln" +if (($type -ne "src") -and + ($type -ne "ref") -and + ($type -ne "tests")) +{ + Write-Host "Unsupported type '$($type)'. Must be 'src', 'ref', or 'tests'." + exit +} + +$SolutionName = "Libraries.$($type).Generated.sln" # Delete the existing solution if it exists if (Test-Path $SolutionName) @@ -19,8 +27,8 @@ if (Test-Path $SolutionName) # Create the new solution dotnet new sln --name $([System.IO.Path]::GetFileNameWithoutExtension($SolutionName)) -# Populate it with all *\src\*.csproj projects -foreach ($f in Get-ChildItem -Path $([System.IO.Path]::Combine("*", $type, "*")) -Filter *.csproj) +# Populate it with all *\$type\*.csproj projects +foreach ($f in Get-ChildItem -Recurse -Path $([System.IO.Path]::Combine("*", $type)) -Filter *.csproj) { dotnet sln $SolutionName add --in-root $f.FullName }