ASP.Net 编译器如何在部署中排除 .svn 目录
在我的本地计算机上,我检查了一个 Web 应用程序,然后使用 MSBuild 对其进行编译,然后使用 aspnet_compiler 对其进行预编译和部署。命令行如下所示:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p C:\<Some Dir> -u C:\<Some Target Dir> -f
这在本地测试中运行良好,这意味着预编译的网站将被复制到目标目录,而不会将任何 .svn 目录复制到其中。但是,在我为 CC.Net 编写了构建脚本的远程计算机上,.svn 目录确实会被复制。为 aspnet_compiler 手动运行命令行会得到相同的结果(复制 .svn 文件夹):
D:\Program Files\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p D:\<Some Dir> -u D:\<Some Target Dir> -f
在这两种情况下,我都是从 x86 VS 工具提示符运行。知道为什么会有不同的行为吗?
On my local machine I have checked out a web application and then compiled it with MSBuild, and then pre-compiled and deployed it with the aspnet_compiler. The command line looks like:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p C:\<Some Dir> -u C:\<Some Target Dir> -f
This works fine locally in testing, meaning the pre-compiled website gets copied to the target directory without copying any .svn directories to it. However, on a remote machine where I have scripted the build for CC.Net, the .svn directories do get copied over. Running the command line manually for the aspnet_compiler gives the same results (copies over the .svn folders):
D:\Program Files\Microsoft Visual Studio 10.0\VC>aspnet_compiler.exe -v / -p D:\<Some Dir> -u D:\<Some Target Dir> -f
In both instances I am running from the x86 VS tools prompt. Any idea why there is different behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 CCNet,我建议将其告诉 SVN 导出而不是签出。这样就可以解决这个问题了。当真正进行集成构建时,你的构建源中不应该有任何 VCS CRUD。
您必须直接在 CCNet 中调用 svn 命令行客户端,而不是执行 svn scm 块。
这一直让我很恼火,这就是我现在使用 TeamCity 的原因(它做得很好)。
一个小小的预感是,当使用 TortoiseSVN 时,它会创建隐藏的 .svn 文件夹,但当 CCNet 调用 svn.exe 时,它不会隐藏这些文件夹。我认为 aspnet_compiler 对此很敏感。
If you are using CCNet, I would suggest telling it to SVN export rather than check out. That will get around the issue. You shouldn't have any VCS crud in your build source when doing an integration build really.
You will have to call the svn command line client directly in CCNet rather than doing an svn scm block.
This has always annoyed the hell out of me which is why I use TeamCity now (which does this fine).
A small hunch has been that when using TortoiseSVN, it creates the .svn folders as hidden but when CCNet calls svn.exe it doesn't hide the folders. I think the aspnet_compiler is sensitive to that.
您可以发布这样的代码,这将删除所有 svn 文件
,或者您可以像这样使用它,递归地删除所有 svn 文件
you can publish the code like this which will remove all svn files
or you can use like this which remove all svn files recursively
感谢您的回复。事实证明,我能够对 svn 存储库本身进行核攻击,然后重新检查它并运行 aspnet_compiler 来解决问题。
Thanks for the responses. It turns out that I was able to just nuke the svn repository itself and re-check it out and run the aspnet_compiler which solved the problem.