tags:

views:

156

answers:

2

I debug my project from console with MsBuild.exe. After i compile project i want to start and test it, but i have problem that i can not start Cassini for testing project. Can i run Cassini from console?

+2  A: 

You can call it with this format:

WebDev.WebServer /port:9999 /path:"C:\Projects\Web Site"

The below info is from my machine for a default location install, YMMY.


For 2.0 - 3.5/VS 2008, it's at:

C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\9.0

And it's just WebDev.WebServer.exe


For 4.0/VS 2010 it moved to the 10.0 directory, it's at:

C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0

And there's a WebDev.WebServer20 and WebDev.WebServer40 for the different CLR versions.

Nick Craver
huh that was fast. Thx i will test it.
senzacionale
@senzacionale - I'll update the answer with the 2k8 location, forgot that one woops.
Nick Craver
Nick, for future reference, take a look at the article linked in my answer.
Sky Sanders
+1  A: 

The problem with starting WebDev.WebServer from the command line is that you do not know if the port you are asking for is already in use, in which case a nasty modal dialog will be shown, and there is no reliable way to shut it down when you are finished.

You can reliably host WebDev.WebHost, which is the core of WebDev.WebServer, and with a few helper methods, can ensure you get an open port and you can reliably shut it down.

See the second example on this page: http://www.codeproject.com/KB/aspnet/test-with-vs-devserver-2.aspx

And, as you already know, CassiniDev offers some extended capabilities. The Fixture class can give you full control of the server. But unless you actually need to use an IP other than loopback, self hosting WebDev.WebHost is probably your best bet.

Sky Sanders