包括关闭编译成一个asp.net应用程序中使用命令行 [英] including Closure Compiler into an asp.net app using command line

查看:104
本文介绍了包括关闭编译成一个asp.net应用程序中使用命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我对一个aspx的pageLoad的(方法稍后会移动到AppCode目录的文件)看起来像这样调用一个方法:

 公共部分类PagesSystem_TestGCC:System.Web.UI.Page 
{
保护无效的Page_Load(对象发件人,EventArgs五)
{
串strCmdText;

strCmdText =/ K Java的罐子C:\\TheSite\\compiler.jar --js
C:\\TheSite\\JSTest\ \hello.js --js_output_file
C:\\TheSite\\JSTest\\hello-compiled.js

System.Diagnostics.Process.Start(的CMD.exe,strCmdText);
}
}



的问题是,这种方法依赖于使用计算机的文件系统。我需要做什么在我的代码修改,使其与应用程序的根工作的?



感谢。


解决方案

在命令行窗口闪烁打开,然后关闭,没有一个机会,看看发生了什么事情。




使用CMD.EXE / K ... 而不是的cmd.exe / c ...



我觉得你的实际的问题是不是访问权限或没有的java.exe 。在 PATH 的ASP.Net用户的



使用此代码:

  System.Diagnostics.Process.Start(
新的ProcessStartInfo {
=文件名的java.exe,
参数=罐子compiler.jar --js JSTest / hello.js --js_output_file JSTest / HELLO-compiled.js,
工作目录= HttpRuntime.AppDomainAppPath,
UseShellExecute = FALSE
}
);


I have a method that I call on PageLoad of an aspx (the method will later be moved to a file in the AppCode dir) that looks like this:

public partial class PagesSystem_TestGCC : System.Web.UI.Page
{
     protected void Page_Load(object sender, EventArgs e)
     {
        string strCmdText;

        strCmdText = "/K java -jar c:\\TheSite\\compiler.jar --js      
                      c:\\TheSite\\JSTest\\hello.js --js_output_file
                      c:\\TheSite\\JSTest\\hello-compiled.js";

            System.Diagnostics.Process.Start("CMD.exe", strCmdText);
     }
}

The problem is that this approach relies on using the computer's file system. What do I need to change in my code to make it work with the application's root?

Thanks.

解决方案

the command line window flickers open and then closes, without a chance to see what's going on

Use "cmd.exe /K ... instead of "cmd.exe /C ....

I think that your actual problem is either access permissions or not having java.exe in the PATH of the ASP.Net user.

Use this code:

System.Diagnostics.Process.Start(
    new ProcessStartInfo {
        FileName = "java.exe",
        Arguments = "-jar compiler.jar --js JSTest/hello.js --js_output_file JSTest/hello-compiled.js",
        WorkingDirectory = HttpRuntime.AppDomainAppPath,
        UseShellExecute = false
    }
);

这篇关于包括关闭编译成一个asp.net应用程序中使用命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆