Skip to content

Instantly share code, notes, and snippets.

@wieslawsoltes
Last active November 1, 2017 15:46
Show Gist options
  • Save wieslawsoltes/0b5d5a0033e9217e6d87fb816f4ea3be to your computer and use it in GitHub Desktop.
Save wieslawsoltes/0b5d5a0033e9217e6d87fb816f4ea3be to your computer and use it in GitHub Desktop.
# .\Publish-All-Avalonia-Projects.ps1 -Path ".\_PUBLISH_" -RuntimeIdentifier "win7-x64"
# .\Publish-All-Avalonia-Projects.ps1 -Path ".\_PUBLISH_" -RuntimeIdentifier "ubuntu.14.04-x64"
# .\Publish-All-Avalonia-Projects.ps1 -Path ".\_PUBLISH_" -RuntimeIdentifier "osx.10.12-x64"
<#
.SYNOPSIS
This is a Powershell script to publish .NET Core projects.
.DESCRIPTION
This Powershell script will publish .NET Core projects.
.PARAMETER Path
The output path.
.PARAMETER RuntimeIdentifier
The runtime identifier.
#>
[CmdletBinding()]
Param(
[string]$Path = (Get-Item -Path ".\_PUBLISH_" -Verbose).FullName,
[string]$RuntimeIdentifier = "win7-x64"
)
$Projects =
@(
( "AvaloniaBehaviors", "AvaloniaBehaviors/samples/BehaviorsTestApplication.NetCore" ),
( "ColorBlender", "ColorBlender/samples/ColorBlenderAvalonia" ),
( "Core2D", "Core2D/apps/Core2D.Avalonia" ),
( "Demo1", "Demo1/src/Demo1" ),
( "Draw2D", "Draw2D/src/Core2D.Avalonia" ),
( "PanAndZoom", "PanAndZoom/samples/AvaloniaDemo" ),
( "ReactiveHistory", "ReactiveHistory/samples/ReactiveHistorySample.Avalonia" ),
( "SimpleWavSplitter", "SimpleWavSplitter/src/SimpleWavSplitter.Avalonia" ),
( "SpiroNet", "SpiroNet/samples/SpiroNet.Avalonia" )
)
if(!(Test-Path -Path $Path )) {
New-Item -ItemType directory -Name $Path
}
$OutputPath = Resolve-Path $Path
$OutputPath = (Get-Item -Path $OutputPath -Verbose).FullName
foreach ($Project in $Projects) {
Try {
"Publishing: " + $Project[0]
$Output = $OutputPath + "/" + $Project[0] + "/" + $RuntimeIdentifier
Push-Location -Path $Project[1]
dotnet restore
dotnet publish -c Release -r $RuntimeIdentifier -o $Output
Pop-Location
}
Catch {
"Failed to publish: " + $Project[0]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment