-recurse(C# 编译器选项)-recurse (C# Compiler Options)

通过 -recurse 选项,可在指定目录 (dir) 的所有子目录中,或项目目录的所有子目录中编译源代码文件。The -recurse option enables you to compile source code files in all child directories of either the specified directory (dir) or of the project directory.

语法Syntax

-recurse:[dir\]file  

自变量Arguments

dir(可选)dir (optional)
希望从中开始搜索的目录。The directory in which you want the search to begin. 如未指定目录,搜索将从项目目录开始。If this is not specified, the search begins in the project directory.

file
要搜索的文件。The file(s) to search for. 允许通配符。Wildcard characters are allowed.

备注Remarks

通过 -recurse 选项,可在指定目录 (dir) 的所有子目录中,或项目目录的所有子目录中编译源代码文件****。The -recurse option lets you compile source code files in all child directories of either the specified directory (dir) or of the project directory.

可在文件名中使用通配符,对项目目录中的所有匹配文件进行编译,而无需使用 -recurse****。You can use wildcards in a file name to compile all matching files in the project directory without using -recurse.

此编译器选项在 Visual Studio 中不可用,并且无法以编程方式更改。This compiler option is unavailable in Visual Studio and cannot be changed programmatically.

示例Example

在当前目录中编译所有 C# 文件:Compiles all C# files in the current directory:

csc *.cs  

编译 dir1\dir2 目录及其下的任何目录中的所有 C# 文件,并生成 dir2.dll:Compiles all of the C# files in the dir1\dir2 directory and any directories below it and generates dir2.dll:

csc -target:library -out:dir2.dll -recurse:dir1\dir2\*.cs  

另请参阅See also