如何在运行时更改vc ++项目的项目配置? [英] How to Change project configurations for vc++ projects at runtime?

查看:104
本文介绍了如何在运行时更改vc ++项目的项目配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs2005中为我的项目自动创建了vc ++项目.
但是我想在运行时更改某些配置
我想知道是否可以使用任何命令行开关

I have a automated the creation of vc++ project for a project of mine in vs2005.
But i want to change certain configurations at runtime
I want to know whether it is possible using any command line switches

推荐答案

您可以在运行Visual Studio的过程中更改任何项目配置参数.就像每个人都这样做一样,这几乎不是您要问的问题.可能是您想询问有关应用程序运行时的信息.这听起来很荒谬.如果您知道什么版本,就不会问它.看来您需要学习编译时间,运行时,应用程序,程序集,可执行模块和过程的基础知识.不,这不仅是不可能的.整个想法没有任何意义.

现在,项目配置实际上直接转换为编译器的命令行开关,或称为MSBuild,后者将所有类型的配置选项转换为编译器的命令行开关.但这是一个编译器,而不是您的应用程序.构建应用程序后,这些选项均不会更改.

您的应用程序可以具有(通常应该具有)一些命令行参数.使用.NET(无论是否使用C ++/CLI,都没有关系),您可以使用我的库(请参阅我的文章 Enumeration-基于命令行的实用程序 [^ ] )或我在文章中推荐的一个或更多库.这样,您可以根据命令行参数实现不同或可选的行为.它与构建配置及其参数没有任何关系,只是忘了这个主意.

—SA
You can change any project configuration parameters during run-time… of Visual Studio. As everyone does that anyway, this is hardly what you are trying to ask about. Probably, you want to ask about you application runtime. And this sounds like an absurd. If you knew what a build does you would not ask about it. It looks like you need to learn the very basics of compile time, run-time, application, assembly, executable module and process. No, it is not just impossible; the whole idea makes no sense.

Now, project configuration is actually translated into command line switches of the compiler directly, or MSBuild which translate all kind of configuration options into command line switches of the compiler. But this is a compiler, not your application. After your application is build, none of these options changes.

Your application can have (and usually should have) some command line parameters. With .NET (C++/CLI or not, does not matter), you can use my library (see my article Enumeration-based Command Line Utility[^]) or one more library I recommend in my article. This way, you can implement different or optional behavior depending on command line parameters. It won''t have anything to do with build configurations and their parameters — just forget the idea.

—SA


这篇关于如何在运行时更改vc ++项目的项目配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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