# 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: 3034 # x-archived: 2012-01-14T07:06:40 # x-published: 2012-11-01T09:39:00 # # function Start-Cassini([string]$physical_path=((@(Coalesce-Args (Find-File Global.asax).DirectoryName "."))[0]), [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) } }