Visual Studio 中的多个预构建事件? [英] Multiple Pre-Build Events in Visual Studio?

查看:21
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆