如何在Visual Studio项目中为各种功能引入多个版本? [英] How to introduce multiple releases for various functionalities in Visual Studio project?

查看:104
本文介绍了如何在Visual Studio项目中为各种功能引入多个版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在Windows XP上使用VC ++和Visual Studio 2010开发ActiveX控件.

我想为我的项目提供多种发布类型.版本类型在功能上会有所不同.版本A可能仅具有功能A1 ...而版本B可能仅具有功能B1 .... Bn.另外,项目中使用了第三方库.特定版本仅考虑与其功能相关的库.

如何做到这一点?是否可以通过宏或其他任何机制引入条件,以使特定发行版仅构建有限的功能集?

问候,
Rajesh G Manwani

Hi,

I am developing ActiveX control using VC++ with Visual Studio 2010, on WindowsXP.

I want to have multiple release types for my project. The release types will differ in features. The release A may have only features A1...An while Release B may have only features B1....Bn. Also, there are third-party libraries being used in project. A particular release will only consider libraries relevant to its features.

How can this be achieved? Is it possible to introduce conditions thru macros or any other mechanism, into build so that particular release builds only limited set of features?

Regards,
Rajesh G Manwani

推荐答案

宏是编译时功能,而不是运行时功能.

实现此目的的一种方法是在项目中包含一个或多个DLL,这些DLL会启用一种不同的功能,然后根据是否存在DLL来确定这些功能的可用性.

当然,还有很多其他方法,但是这可能是最简单的实现.
Macros are compile-time features, not runtime features.

One way to accomplish this would be to include one or more DLLs in your project that turn one various features, and then base those features'' availablity on the presence or absence of the DLLs.

Of course, there are many other ways, but this one is probably the simplest to implement.


一种方法是这样的:

a)创建一个函数InitializeComponent(Key)

//密钥作为参数传递.
对于不同的客户,密钥是不同的
对于客户"A",它是3123123
对于客户"B",它是2343454

b)客户必须使用此功能.

c)检查键值是否正确.

c)根据该密钥,客户端只能使用该功能.
One way is like that:

a) Create One Function InitializeComponent(Key)

// Key is passed as argument.
For Different client, the key is different
For Client ''A'' it is 3123123
For Client ''B'' it is 2343454

b)Client must use this function.

c) Check the key value is correct.

c) According to that key only feature is available to client.


您好,Rajesh,
使用 Visual Studio配置管理器(在构建"菜单中)创建不同的项目配置,请参见
Hi Rajesh,
Use the Visual Studio Configuration Manager (in Build menu) to create different project configurations, see How to: Create and Edit Configurations[^].
Use compile time definitions to adjust specific configuration features.
cheers,
AR


这篇关于如何在Visual Studio项目中为各种功能引入多个版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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