使用CSC分别在一个目录中编译多个文件 [英] Compiling multiple files in a single directory separately with CSC
问题描述
我在一个目录中有多个C#源文件(大约50个).我想做的是分别编译所有文件,即每个文件都应生成自己的可执行文件. (有些文件深一个或两个目录.)
I have multiple C# sources files (around 50) in a directory. What I want to do is to compile all of them separately, i.e. so that each of them should generate its own executable file. (Some of the files are one or 2 directories deep.)
目前我在做什么
csc *.cs /recurse:*.cs
这里的问题是CSC尝试将所有文件编译在一起,并找到方法Main
的多个实例.我知道这是正确的行为,但这不是我想要的.
The problem here is that CSC tries to compile all of the files together and finds multiple instance of the method Main
. I know this is the correct behavior but this it's not what I'm looking for.
写批处理脚本是我唯一的选择,还是可以做某种单命令通配符魔术来分别编译所有文件?
Is writing a batch script my only option or can I do some kind of single command wildcard magic to compile all of the files separately?
推荐答案
使用简单的蝙蝠应该做
这篇关于使用CSC分别在一个目录中编译多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!