Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.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
C# MSBUILD如何调用CSC.exe?_C#_Visual Studio_Compilation_Msbuild_Csc - Fatal编程技术网

C# MSBUILD如何调用CSC.exe?

C# MSBUILD如何调用CSC.exe?,c#,visual-studio,compilation,msbuild,csc,C#,Visual Studio,Compilation,Msbuild,Csc,我想知道msbuild.exe如何执行C#应用程序 当我在谷歌搜索时,我知道了csc.exe、PE文件、JIT文件和IL文件。msbuild.exe在内部调用csc.exe来编译C#应用程序。所以我在reflector中打开了csc.exe。但是没有从msbuild调用csc.exe。那么,msbuild如何调用csc.exe呢?对csc.exe的调用包含在相应的.targets1脚本中。msbuild.exe本身不知道您针对的是哪种语言编译器(c#,vb,…)。这取决于解决方案/项目及其参考

我想知道msbuild.exe如何执行C#应用程序


当我在谷歌搜索时,我知道了csc.exe、PE文件、JIT文件和IL文件。msbuild.exe在内部调用csc.exe来编译C#应用程序。所以我在reflector中打开了csc.exe。但是没有从msbuild调用csc.exe。那么,msbuild如何调用csc.exe呢?

对csc.exe的调用包含在相应的.targets1脚本中。
msbuild.exe本身不知道您针对的是哪种语言编译器(c#,vb,…)。这取决于解决方案/项目及其参考

对csc.exe的实际调用应位于.NET Framework文件夹中的Microsoft.MSBuild.Tasks.dll中


1在C#的情况下,它是Microsoft.CSharp.targets

尽管EXE实际上是库(与DLL一样,EXE是PE文件),但它们几乎总是通过使用命令行参数创建单独的进程来调用。 命令行参数通常作为字符串数组传递给EXE的“main”函数。您可以通过反射器找到csc的主要功能

但是,您可能想知道对于特定的生成,msbuild传递给csc的是什么。在这种情况下,只需使用msbuild的详细度开关:

msbuild MyProject.csproj /target:rebuild /verbosity:diag

参见。

汉斯·帕桑:谢谢。CSC.exe将在何处生成PE文件IL文件?