Skip to content

Instantly share code, notes, and snippets.

@sunnyneo
Created August 25, 2018 09:10
Show Gist options
  • Save sunnyneo/c3769c1c6b7386a362a91477b63da501 to your computer and use it in GitHub Desktop.
Save sunnyneo/c3769c1c6b7386a362a91477b63da501 to your computer and use it in GitHub Desktop.
Clone all repositories in GhostPack and Build Them
# Get repositories git url and clone them
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$req = 'https://api.github.com/users/GhostPack/repos?page=$PAGE&per_page=100'
$respObj = Invoke-WebRequest $req | ConvertFrom-Json
$respObj | select -Property git_url | ForEach { git clone $_.git_url -q }
# Replace all Build Output to current location
Get-ChildItem '*.csproj' -Recurse | ForEach {
(Get-Content $_ | ForEach { $_ -replace '<OutputPath>bin\\Release\\<\/OutputPath>', '<OutputPath>..\..\</OutputPath>' }) |
Set-Content $_
}
# MSBuild Template
# https://stackoverflow.com/questions/22131757/build-multiple-visual-studio-solutions-simultaneously
$msbuildTemplate = '<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Solution Include="**/*.sln">
<Properties>Configuration=Release;Platform=Any CPU</Properties>
</Solution>
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" ''$(Configuration)'' == '''' ">Release</Configuration>
<Platform Condition=" ''$(Platform)'' == '''' ">AnyCPU</Platform>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Build" />
</Target>
<Target Name="Clean">
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Clean" />
</Target>
<Target Name="Rebuild">
<MSBuild Projects="@(Solution)" BuildInParallel="true" Targets="Rebuild" />
</Target>
</Project>'
$fileName = 'build_every_solution.csproj'
# Create MSBuild Template
Set-Content -Value $msbuildTemplate -Path $fileName
# Build solutions
msbuild $fileName /m:4 /ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment