Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';在.NET代码中连接TSC最简单的方法是什么?_.net_Typescript - Fatal编程技术网

什么';在.NET代码中连接TSC最简单的方法是什么?

什么';在.NET代码中连接TSC最简单的方法是什么?,.net,typescript,.net,Typescript,我希望在代码中的某个地方有一个函数,该函数以typescript字符串作为参数,并在返回时输出javascript字符串。我正在考虑将tsc编译器连接到ClearScript提供的V8上,但这方面的文档并不是很完整,我想我正在寻找nuget包形式的快捷方式。有什么建议吗?typescript编译器只是一个命令行可执行文件tsc.exe。您可以通过执行以下操作来完成此任务: // write text to temporary .ts file ... var startInfo = new P

我希望在代码中的某个地方有一个函数,该函数以typescript字符串作为参数,并在返回时输出javascript字符串。我正在考虑将tsc编译器连接到ClearScript提供的V8上,但这方面的文档并不是很完整,我想我正在寻找nuget包形式的快捷方式。有什么建议吗?

typescript编译器只是一个命令行可执行文件tsc.exe。您可以通过执行以下操作来完成此任务:

// write text to temporary .ts file ...

var startInfo = new ProcessStartInfo {;
    FileName = "\path\to\tsc.exe",
    Arguments = args   // parameters to pass to tsc, including .ts
};
Process.Start(startInfo);

// read text from newly created .js file

typescript编译器只是一个命令行可执行文件tsc.exe。您可以通过执行以下操作来完成此任务:

// write text to temporary .ts file ...

var startInfo = new ProcessStartInfo {;
    FileName = "\path\to\tsc.exe",
    Arguments = args   // parameters to pass to tsc, including .ts
};
Process.Start(startInfo);

// read text from newly created .js file

这是可以接受的,但是因为我已经在我的应用程序中使用V8进行其他操作,所以让编译器的javascript版本处理源文件似乎不那么麻烦。这里还有另一个问题和答案试图做到这一点:[.在这种情况下,答案并不完整,但您可能会发现它很有帮助。您也可以查看typescript Playerd网站,[该网站在一个实时页面中将ts代码编译为js。查看该页面的源代码,有一条评论说“编译逻辑”-看起来getEmitOutput是完成这项工作的方法。这是可以接受的,但是因为我已经在我的应用程序中使用V8进行其他操作,所以让编译器的javascript版本处理源文件似乎不那么麻烦。这里还有另一个问题和答案试图做到这一点:[.在这种情况下,答案并不完整,但您可能会发现它很有帮助。您还可以查看typescript Playerd网站,[该网站将ts代码在一个实时页面中编译为js。查看该页面的源代码,有一条注释说“编译逻辑”-看起来getEmitOutput就是完成此工作的方法。