2011-08-25 45 views
0

我只想把我所有的代码放在一个文件中发送和查看。是否有可能将Visual Studio项目合并到单个文件中?

这里是我想要的想法。

****Myclass.cs**** 
code 
code 
code 
code 
code 
*****file2.cs***** 
code 
code 
code 
+2

呃... zip文件? –

+0

不,不,不。我想要一个单独的文本文件,所以我可以说它粘贴到SO帖子。像这样回答#2 http://meta.stackexchange.com/questions/2677/database-schema-documentation-for-the-public-data-dump-and-data-explorer/2678#2678 –

+0

没有什么可以停止的你可以将每个类放在彼此之下。 –

回答

1

更简单:

type *.cs > oneFile.txt 

虽然这不会把文件之间的分隔符。但是,这个:

type *.cs >output.txt 2>&1 

将在每个文件的内容之前放置文件名。

+0

+ +1为我的文件名!现在怎么做正则表达式像'following /^.* \。(inc | cs | vb | cshtml)$ /'我发现的例子非常复杂和复杂 –

+0

@Doug - 现在你问了;) – ChrisF

0

安装cygwin,添加到路径,然后从命令提示符运行find path/to/my/project -name '*.cs' | xargs cat

0

你可以用DOS做它的命令 - 无需安装cygwin:

for %f in (*.cs) do (
    if exist oneFile.txt del oneFile.txt 
    echo %f ---- File: %f ---- >> oneFile.txt 
    type %f >> oneFile.txt 
) 

如果您有不同类型的文件,你可以在自己的名字居然密钥而不是“*的.cs”

相关问题