如何在不打开 Visual Studio 2008 的情况下从 .sln 文件启动 WebDevServer

发布于 2024-08-21 15:23:09 字数 221 浏览 2 评论 0 原文

有没有办法通过传入 .sln 文件来启动 WebDevServer(Visual Web Development Server),而无需实际打开 Visual Studio 2008?我是一名JavaScript开发人员,在一个客户端项目中工作,我想节省VS消耗的内存开销,并将其交给多个浏览器进行跨浏览器测试。我对设置 IIS 犹豫不决(Visual Web Dev 服务器是 Cassini 的轻量级服务器)。请指教。谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

漫雪独思 2024-08-28 15:23:09

是的,您无需从文件系统模式打开 Visual Studio 即可运行应用程序。请参阅下面为 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));

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));
九命猫 2024-08-28 15:23:09

不可以,您无法从 Visual Studio 上下文之外的 .sln 启动 webdev 或任何其他服务器。

是的,您可以通过传递应用程序的目录从命令行启动 webdev,但您可能会发现 CassiniDev< /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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文