views:

38

answers:

2

Is there a way to start WebDevServer (Visual Web Development Server) by passing in the .sln file without actually opening Visual Studio 2008? I am a JavaScript developer and I work in a client project and I want to save the memory overhead consumed by VS and give it to multiple browsers for cross-browser testing. I am hesitant with setting up IIS (Visual Web Dev server is SO LIGHT-WEIGHT being Cassini). Please advice. Thanks!

A: 

Yes, you can run your application without opening Visual studio from File system mode. Refer the below code snippet which is provided for VS 2008.

string randomportnumber = string.Format("{0}", new Random().Next(0x3e9, 0x4e20));
string applicationpath = @"c:\work\yourwebapplication";

 Process process = new Process();
                process.StartInfo.FileName = "WebDev.WebServer.EXE"
                process.StartInfo.WorkingDirectory = @"C:\Program Files\Common Files\Microsoft Shared\DevServer\9.0\";
                process.StartInfo.Arguments = string.Format("/port:{0} /path:\"{1}\" /vpath:\"/{2}\"", randomportnumber, applicationpath, string.Empty);

                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                process.Start();
                Thread.Sleep(new TimeSpan(0, 0, 10));

                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                Process.Start(string.Format("http://localhost:{0}/default.aspx", randomportnumber));
sankar
+1  A: 

No, you cannot start webdev or any other server from an .sln outside of the visual studio context.

Yes, you can start webdev from the command line by passing the directory of your application, but you might find CassiniDev quite useful in your workflow.

It is specifically designed to support your requirements.

Sky Sanders