Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param (
- [Parameter(Mandatory=$true)][string]$OutputDir
- )
- # First run dotnet restore for each of the projects
- # We need this because dotnet publish does not restore dependencies on referenced projects
- Get-ChildItem |
- Foreach-Object {
- Write-Output "============================="
- Write-Output $_.Name
- Write-Output "============================="
- Write-Output "Running dotnet restore for project: " + $_.Name;
- $Command = "dotnet restore """ + $_.FullName + "\project.json"""
- Write-Output $Command
- iex $Command
- }
- # Now that all dependencies are restored, run dotnet publish to the output dir
- Get-ChildItem |
- Foreach-Object {
- Write-Output "============================="
- Write-Output $_.Name
- Write-Output "============================="
- $OutputFolder = $OutputDir + "\" + $_.Name
- $FolderExists = Test-Path($OutputFolder)
- if ($FolderExists -eq $False)
- {
- New-Item $OutputFolder -type directory
- Write-Output "Create Output folder: " + $OutputFolder;
- }
- # Need to remove read only attribute since TFS get will set the readonly attribute
- $Command = "attrib -r """ + $_.FullName + "\*.*"" /S";
- Write-Output $Command
- iex $Command
- $Command = "attrib -r """ + $OutputFolder + "\*.*"" /S";
- Write-Output $Command
- iex $Command
- Write-Output "Publishing " + $_.Name;
- $Command = "dotnet publish """ + $_.FullName + "\project.json"" -o """ + $OutputFolder + """ -c Release"
- Write-Output $Command
- iex $Command
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement