Compiling multiple files in a single directory separately with CSC

独自空忆成欢 提交于 2019-12-11 06:27:41

问题


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.)

Currently what i am doing is

csc *.cs /recurse:*.cs

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?


回答1:


Using a simple bat for loop like

for /R %f in (*.cs) do csc %f 

should do



来源:https://stackoverflow.com/questions/13212833/compiling-multiple-files-in-a-single-directory-separately-with-csc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!