将变量发送到 Visual Studio 2008 构建事件命令行
我想将其他参数发送到我在 Visual Studio 2008 的“预构建事件命令行”中运行的批处理文件。我可以通过传入将目录(“cd”)更改为当前的“解决方案目录” “$(解决方案目录)\MyProject”。
我可以传递构建版本吗?我已将 AssemblyInfo.cs 设置为自动增量(如下所述:http://blog.mbcharbonneau.com/2007/03/13/auto-incrementing-build-numbers-in-visual-studio/)
谢谢@jeffamaphone。如果你真的回答,我可以接受。
或者,我终于在这里也找到了类似的东西。 http://www.blackwasp.co.uk/VSBuildEvents.aspx
I would like to send additional parameters to the batch file that I'm running in the "Pre-build event command line" of Visual Studio 2008. I can change directory ("cd") to the current "solution directory" by passing in "$(SolutionDir)\MyProject".
Can I pass in the build version? I've set my AssemblyInfo.cs to auto increment (as described here : http://blog.mbcharbonneau.com/2007/03/13/auto-incrementing-build-numbers-in-visual-studio/)
Thanks @jeffamaphone. If you actually answer, I can accept.
Alternatively, I finally found something similar here as well.
http://www.blackwasp.co.uk/VSBuildEvents.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有在 2k8 中尝试过这一点,但在 2k3 和 2k5 中,我使用了在事件命令中设置 env-vars 的技巧...它可以是多个,IIRC 它们在一个 cmd 实例下有效地作为批处理脚本运行。 EXE文件。
例如:
设置 BUILD_VERSION=$(BuildVersion)
cd "$(SolutionDir)\MYproject"
雷姆做更多的事情
I haven't tried this in 2k8, but in 2k3 and 2k5 I used the trick of setting env-vars in the event command ... it can be multiples and IIRC they effectively run as a batch-script under one instanced of cmd.exe.
e.g.:
set BUILD_VERSION=$(BuildVersion)
cd "$(SolutionDir)\MYproject"
rem do more stuff
最后,我无法让 $(BuildVersion) 或 $(ApplicationRevision) 工作。我团队的另一名成员构建了一个小型 .exe 文件,该文件从 Web 项目 dll 文件中检索版本号。
In the end, I was not able to get $(BuildVersion) or $(ApplicationRevision) to work. Another member of my team built a small .exe file that retrieved the Version Number from the web project dll file.