eShopOnContainers/src/Create-DockerfileSolutionRestore.ps1

19 lines
887 B
PowerShell
Raw Normal View History

2019-11-18 15:04:11 +00:00
param (
[string]$solution = "eShopOnContainers-ServicesAndWebApps.sln"
)
2019-11-18 18:38:35 +00:00
$outfile = "DockerfileSolutionRestore.txt"
2019-11-18 15:04:11 +00:00
Write-Output "COPY ""$solution"" ""$solution""" > $outfile
Add-Content -Path $outfile ""
Select-String -Path $solution -Pattern ', "(.*?\.csproj)"' | ForEach-Object { $_.Matches.Groups[1].Value.Replace("\", "/") } | Sort-Object | ForEach-Object {"COPY ""$_"" ""$_"""} | Out-File -FilePath $outfile -Append
Add-Content -Path $outfile ""
Select-String -Path $solution -Pattern ', "(.*?\.dcproj)"' | ForEach-Object { $_.Matches.Groups[1].Value.Replace("\", "/") } | Sort-Object | ForEach-Object {"COPY ""$_"" ""$_"""} | Out-File -FilePath $outfile -Append
Add-Content -Path $outfile ""
Add-Content -Path $outfile "COPY ""NuGet.config"" ""NuGet.config"""
Add-Content -Path $outfile ""
Add-Content -Path $outfile "RUN dotnet restore ""$solution"""
Get-Content $outfile