Visual Studio:构建项目时检出文件
我有一个构建后事件,它将我的 JavaScript 文件和输出组合到 Production.js,但是如果未签出 Production.js,构建就会失败。
项目构建时是否可以自动检查Production.js?
[编辑] 如果可能使用构建后事件,有人知道如何做到这一点吗?我使用的是 Visual Studio 2008。
I have a post build event that combines my JavaScript files and outputs to Production.js, however if Production.js is not checked out, the build fails.
Is it possible to automatically check Production.js out when a project is built?
[Edit]
If possible using a post-build event, does anyone know how to do this? I am using Visual Studio 2008.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 tf 命令行检出目标文件:
Checkout the target file with the tf commandline:
我认为最简单的解决方案是进行构建后步骤,检查 Production.js 文件。
设置自动检出文件等选项在这里不起作用,因为 Visual Studio 只会自动检出文件以进行其认为可编辑的操作。它不理解您的后/预构建步骤,因此不会进行检查。
I think the simplest solution is to have a post-build step which checks out the Production.js file.
Setting options like automatic checkout of files won't work here because Visual Studio will only automatically check out files for actions it considers edits. It doesn't understand your post / pre build steps and hence won't do a check out.
@JaredPar 有正确的技巧来在构建后事件中自动签出文件。
我向您提出的问题(警告?)是:您为什么尝试使用缩小/组合的 javascript 文件覆盖源文件?
在我看来,如果您执行一些构建后事件来缩小/组合将一些 javascript 文件放入一个从未触及的新目标文件 (Production.js) 中..这只是构建后事件的输出...我建议您不要在构建后事件中执行此操作,而是某些事件的一部分正确的源代码控制部署场景。
例如,我发布了一个视频如何将 TFS2008 与 YUICompressor.NET 结合使用它展示了如何确保每次签入时都缩小/组合您的 javascript。
再说一遍,您使用的是 Visual Source Safe,这是一个严重问题,我会在其他任何事情之前解决该问题 。
@JaredPar has the correct tricks to autocheckout a file on a post build event.
My question (warning?) to you is : why are you trying to OVERRIDE the source file with a minified/combined javascript file?
In my opinion, if your doing some post-build event to minify/combine some javascript files into a new destination file (Production.js) which is never touched .. it's just the output of post-build event ... i would suggest you don't do this in a post build event, but part of some proper source control deployment scenario.
For example, I've put up a video how to use TFS2008 with YUICompressor.NET which shows how you can make sure that your javascript are minified/combined whenever a checkin occurs.
Then again, you're using Visual Source Safe and that is a serious issue which I would address before -anything- else.
如果您使用的是 TFS2012 或更高版本,请使用本地工作区。然后该文件将不再是只读的,您就可以开始了。
If you're in TFS2012 or later, use a local workspace. Then the file won't be readonly and you'll be good to go.