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

查看:82
本文介绍了在Visual Studio中有多个预构建事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了Scott Hanselman的博客文章,内容为使用PreBuild Events管理配置并使其正常工作.

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天全站免登陆