Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Win32 Visual-Studio compiler , +
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
Posted 7-Dec-10 2:03am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Dalek Dave at 8-Dec-10 3:52am
   
Good Call.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

This is a large topic and there are many considerations. For example, at one extreme you can have one executable and use run-time flags to control which features are seen. At the other extreme you can create different release configurations (see below) that define macros (for conditional compilation) and only link to the relevant libraries.
 
The advantage of the first method is that the development, build and distribution process is simplified. The disadvantage is in efficiency (a larger distribution and probably more memory use etc).
 
The advantage of the second is that each release is close to the optimum for its requirement. However, if there are many differences then the conditional compilation can make the source code a mess.
 
In practice you will probably use a compromise between these two extremes. For example, you could create a simple "plugin" system where different plugins (DLLs) are only used if present - as someone else already suggested.
 
Another alternative is to use inheritance where the core system consists of many base classes with virtual "hook" functions. Variations of the product could use different derived classes to override the virtual functions to provide different behaviours.
 
Configurations
 
By default Visual Studio only creates two configurations (Debug and Release), but you can use the Configurations manager to create extra release configurations by cloning the existing release config. Then you can use the Properties pages to define preprocessor flags (C/C++ -> Preprocessor -> Preprocessor Defintions) that can control your compilation, and change which libraries you link with (Link -> Input -> Additional Dependencies).
  Permalink  
Comments
Dalek Dave at 8-Dec-10 3:51am
   
Good Answer.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Thank you all for your response.
 
I have read each of the solutions and admire the knowledge exhibhited in each of them.
 
All the solutions are genuine and feasible. I think that making different Visual Studio Configurations will be sufficient for my needs
and I will try this. If it does not work, I may evaluate other solutions.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

In a VS2010 project, I created a new configuration C2 copying settings from C1. The purpose of having new configuration was to do conditional compiling. I thought I can achieve it thru different peprocessors. But I found that when I define a processor in either C1 or C2, it gets reflected in both C1 & C2. How this can be stopped? Can different configurations have different preprocessor defintion? or there is some different mechanism to achieve it?
  Permalink  
Comments
Estys at 5-Feb-11 6:28am
   
If I were you, I would make this a new question. AFAIK you cannot do this with VS. A suggestion : google for "MSBuild" and "Nant".
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

Something else to consider is to make sure that the target machine has the version of .NET installed that you are targeting with your VS2010 project.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 197
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 21 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100