PoshCode Archive  Artifact Content

Artifact 5b4a80d60c51b8422bd625a0d103017b05e24821363c1c9048a78c9000409f8d:

  • File Start-Cassini.ps1 — part of check-in [4ee1afeef3] at 2018-06-10 13:15:47 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: 986)

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