PoshCode Archive  Artifact Content

Artifact 2178ac412d75b4a477c616be3cadff218db40c09c7e98ebb4384f8055b124f8e:

  • File Start-Cassini.ps1 — part of check-in [f890c76e2c] at 2018-06-10 13:19:10 on branch trunk — Start up the .Net 4.0 Cassini Webserver. Useful for those of us who like to avoid opening visual studio (user: George Mauer size: 1048)

# 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)
  }
}