Visual Studio 中的多个预构建事件? [英] Multiple Pre-Build Events in Visual Studio?
问题描述
我关注了 Scott Hanselman 关于使用预构建事件管理配置的博文并让它工作正常.
I've followed a blog post by Scott Hanselman for managing configuration with PreBuild Events and have it working fine.
我现在想将我的配置拆分成几个不同的文件,因此需要在构建之前再次执行该命令.问题是 PreBuild 事件文本都作为一个控制台命令执行.如何将其拆分为多个命令?
I now want to split up my configuration into a couple of different files, so need to exectue the command again before the build. The problem is the PreBuild event text all gets executed as one console command. How can I split it up as several commands?
推荐答案
事实证明问题在于 Scott 的示例没有在行的开头包含 call
命令.只要您不想使用不同的参数多次执行 .bat
文件,这很好.
Turns out the problem is Scott's example doesn't include the call
command at the start of the line. This is fine as long as you don't want to execute the .bat
file multiple times with different parameters.
这个:
call "$(ProjectDir)copyifnewer.bat" "$(ProjectDir)connectionStrings.config.$(ConfigurationName)" "$(ProjectDir)connectionStrings.config"
call "$(ProjectDir)copyifnewer.bat" "$(ProjectDir)appSettings.config.$(ConfigurationName)" "$(ProjectDir)appSettings.config"
对我来说效果很好.
这篇关于Visual Studio 中的多个预构建事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!