# encoding: ascii
# api: powershell
# title: Start-Cassini
# description: Start up the .Net 4.0 Cassini Webserver. Useful for those of us who like to avoid opening visual studio
# version: 10.0
# type: function
# author: George Mauer
# license: CC0
# function: Start-Cassini
# x-poshcode-id: 2789
# x-archived: 2013-01-11T06:35:29
# x-published: 2013-07-13T13:02:00
#
#
function Start-Cassini([string]$physical_path=".", [int]$port=12372, [switch]$dontOpenBrowser) {
  $serverLocation = Resolve-Path "C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.EXE";
  $full_app_path = Resolve-Path $physical_path
  $url = "http://localhost:$port"
  &($serverLocation.Path) /port:$port /path:"""$($full_app_path.Path)"""
  Write-Host "Started $($full_app_path.Path) on $url"
  Write-Host "Remember you can kill processes with kill -name WebDev*"
  if($dontOpenBrowser -eq $false) {
    [System.Diagnostics.Process]::Start($url)
  }
}
