包括每个构建配置不同的文件 [英] Include different files per build configuration

查看:111
本文介绍了包括每个构建配置不同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有两个不同的版本配置:调试和生产

构建的一部分包括用于访问第三方网站证书。在调试中,我们使用一个临时证书,并在生产中我们使用的现场制作证书。

我如何能确保当溶液是建在调试配置的升级证书包括在内,当它建于生产,生产证书包含?

修改

下面是从斯科蒂的建议我的解决方案(这被放入生成后事件命令行部分):

 如果$(ConfigurationName)==发行拷贝$(PROJECTDIR)资源\\ $ prod.p12(TARGETDIR)资源IF $(ConfigurationName)==调试$复制(PROJECTDIR)资源\\ $ staging.p12(TARGETDIR)资源


解决方案

取决于你如何'证书'被包含在你的项目。

如果它是一个C / C ++文件,右键单击Solution Explorer中的文件,打开属性>常规> 从构建排除即可。排除一个文件为您的调试版本,一个用于发布版本。

如果它是一个外部文件或命令,你可以使用生成事件为每个配置。打开您的项目属性>配置属性>生成事件>生成后事件(或其他事件,如果你喜欢)。从那里,你可以运行任何你想要的命令行。

We have two different build configurations: Debug and Production.

Part of the build includes a cert used to access a third party site. In debug, we use a staging cert and in production we use the live production cert.

How can I ensure when the solution is built in the debug configuration that the staging cert is included and when its built in production, the production cert is included?

EDIT

Here's my solution from Scotty's suggestion (this was put into the Post-Build event command-line section):

IF $(ConfigurationName) == Release copy $(ProjectDir)resources\prod.p12 $(TargetDir)resources

IF $(ConfigurationName) == Debug copy $(ProjectDir)resources\staging.p12 $(TargetDir)resources

解决方案

Depends how your 'cert' is included in your project.

If it's a C/C++ file, right-click the file in Solution Explorer, open Properties > General > Excluded from Build. Exclude one file for your Debug build and one for your Release build.

If it's an external file or command, you can use Build Events for each configuration. Open your project Properties > Configuration Properties > Build Events > Post-Build Event (or another event if you like). From there you can run whatever command line you want.

这篇关于包括每个构建配置不同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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