473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

conditional compile and #IF CONFIG

I'm using conditonal compile with statement #IF CONFIG
This works if I use #IF CONFIG = "Debug" or #IF CONFIG= "Release"

But if I define an other compilation profile, eg. "BestRelease", and I use
#IF CONFIG = "BestRelease", compiler doesn't recognize the true condition
and doesn't compile statements inside #IF... #END IF block.

Is this a bug?
Any other way to have conditional compile in a project, using only a single
variable (I need to test compilation profile in different asp net codebehind
pages, but I want to write only one #CONST profile=...)

thanks
Nov 20 '05 #1
5 7956
Hi Trapulo,

Thanks for posting in the community.

From your description, I understand that when you use #IF CONFIG =
"BestRelease", the compiler doesn't recognize the true condition and
doesn't compile statements inside #IF... #END IF block.
Please correct me if there is any misunderstand.
Is this a bug?

I think it is not a bug, "Config" is a string datatype, which corresponds
to the current setting in the Configuration Manager.

To use the #IF CONFIG = "BestRelease" conditional compilation, I suggest
you to add a new solution configuration "BestRelease" in the Project
Properties.../Configuration Manager/Active Solution Configuration

Please apply my suggestion above and let me know if it helps resolve your
problem.
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 20 '05 #2

"Gary Chang" <v-******@online.microsoft.com> wrote in message
news:Pt*************@cpmsftngxa07.phx.gbl...
From your description, I understand that when you use #IF CONFIG =
"BestRelease", the compiler doesn't recognize the true condition and
doesn't compile statements inside #IF... #END IF block.
Please correct me if there is any misunderstand.


That's right
Either VS desinger doesn't recognize it, not only compiler. Inside the block
I declare some constants, and if I set in release configuration mode I
havent errors, but if I set project in "BestRelease" mode the desinger
reports error where I read this constants.
Is this a bug?

I think it is not a bug, "Config" is a string datatype, which corresponds
to the current setting in the Configuration Manager.

To use the #IF CONFIG = "BestRelease" conditional compilation, I suggest
you to add a new solution configuration "BestRelease" in the Project
Properties.../Configuration Manager/Active Solution Configuration

Please apply my suggestion above and let me know if it helps resolve your
problem.


This is what I made before write the post. But this doesn't work!
I have this code:
#If CONFIG = "Release" Or CONFIG = "Debug" Then

Public Const rootFolderName As String = "one"

Public Const activeBrand As brand = brand.one

#ElseIf CONFIG = "Release_two" Then

Public Const rootFolderName As String = "two"

Public Const activeBrand As brand = brand.two

#End If

If I select Release o Debug configuration profile, all ok.

If I select Release_two, all acceses to two constants reports an error.

However I solved. I noticed that using a third configuration profile I've on
my project, this code works. So I deleted Release_two configuration profile,
and I've created a new Release_two profile copying data from the working
one. Now The code above is working. Any idea of the mistake I made?

I've an other problem. If now I open active solution configuraration, I find
all old profile I don't use. I've tried to delete them (with <Edit...> ->
delete), but if I close and reopen property page, the come back. Any
suggestion?

however.. thanks


Nov 20 '05 #3

"Gary Chang" <v-******@online.microsoft.com> wrote in message
news:jn**************@cpmsftngxa07.phx.gbl...
I've an other problem. If now I open active solution configuration, I findall old profile I don't use. I've tried to delete them (with <Edit...> ->
delete), but if I close and reopen property page, the come back. Any
suggestion?


Yes, I can repro the same problem, it seem a issue, I will consult this
problem to the product team member, and reply if got any response!


Thanks, I'll wait for your solution!

Nov 20 '05 #4
According to the product group this is by design.
We deliberately do not remove project configurations when a solution
configuration is removed. This is to prevent the unintentional deletion of
project configurations.

Thanks,
Susan Huffaker
Microsoft Developer Support

Nov 20 '05 #5
There is one more thing I should say. There is a difference between a
Solution Configuration and a Project Configuration.

If you delete the Solution Configuration, the Project Configuration will
remain in place. They're separate configurations.

To delete the Project Configuration:

Open the Configuration Manager.
Click on the drop-down list under the "Configuration" column- NOT the
"Active Solution Configuration" combo box.
Select <Edit...> and remove the Project configuration.

Hope this helps!
Susan Huffaker
Microsoft Developer Support
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which...
1
by: chris han | last post by:
Hi, all, I'm trying to use Conditional Compilation Statements in my code. using System; #define DEBUG public class MyClass { public static void Main() {
2
by: FireStarter | last post by:
Guys, in the code that follows, why does the method F() still compile, even if DBG is undefined? Inside method G(), the code inside <#if DBG> does not compile (notice that I can write whatever I...
7
by: John Dolinka | last post by:
I have a project of several files with #defines to setup a conditional compile. I would like to put these #defines in a single file and change the conditional compile from this one file with the...
6
by: Marc Jennings | last post by:
Hi there, I am trying to get some conditional functionality into some of my apps. I can use the format : private void doStuff() { //do something }
3
by: John | last post by:
Hi I have an app to deal with two companies A & B within a group of companies depending on which database is selected. Is it possible for setup to ask the user at install time which company they...
1
by: Hossein Farkho | last post by:
I had a ASP.NET 1.1 project with 2 ".csproj" files, each one had different sets of compiler symbols (directives) so I could use the same code and compile two different versions of the project very...
10
by: Dave | last post by:
I'm a C++ programmer of many years, trying to get my feet wet in C#. I have a question about conditional compilation. In C++, I would sometimes define a constant in an include file, and then...
4
by: =?Utf-8?B?Sm9obiBCZXNjaGxlcg==?= | last post by:
I work in a shop with up to three environments for the development/deployment process. Each environment has its own db and web servers and its own web services servers as well. I am developing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.