| re: Strange problem with DEBUG directive
I tested it a little bit more and found something strange.
With a fresh project, <#if DEBUG> works fine.
Now I go to the project property and select Build page and set a conditional
compilation symbol.
Save the change.
Now remove the conditional compilation symbol and save.
<#if DEBUG> doesn't work by now.
I checked the *.cproj file and the problem is same as I described below.
Is it a feature or bug?
Sam
"Sam Kong" <sungshik_kong@hotmail.com> wrote in message
news:eIZWY3tDFHA.2540@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hello!
>
> Recently I had a strange problem with Visual C# 2005 beta 1.
> When I ran(F5 key) a program, <#if DEBUG> statement was not working.
> It ran as RELEASE mode.
> So I had to manually define DEBUG to make #if DEBUG work.
> When I first started the project, this problem didn't exist.
> The problem started to exist in the middle of doing the project.
>
> Today, I decided to figure out what went wrong.
> Finally I pinpointed the cause of the problem.
> In the *.csproj file, I had the following lines.
>
> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Debug|AnyCPU' ">
> <DebugSymbols>true</DebugSymbols>
> <DebugType>full</DebugType>
> <Optimize>false</Optimize>
> <OutputPath>.\bin\Debug\</OutputPath>
> <DefineConstants>
> </DefineConstants>
> </PropertyGroup>
> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Release|AnyCPU' ">
> <DebugSymbols>false</DebugSymbols>
> <Optimize>true</Optimize>
> <OutputPath>.\bin\Release\</OutputPath>
> <DefineConstants>
> </DefineConstants>
> </PropertyGroup>
>
> I compared them with normal ones and found out that they should be like
> the following.
> (See <DefineConstants> lines)
>
> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Debug|AnyCPU' ">
> <DebugSymbols>true</DebugSymbols>
> <DebugType>full</DebugType>
> <Optimize>false</Optimize>
> <OutputPath>.\bin\Debug\</OutputPath>
> <DefineConstants>DEBUG;TRACE</DefineConstants>//***DIFFERENT
> </PropertyGroup>
> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Release|AnyCPU' ">
> <DebugSymbols>false</DebugSymbols>
> <Optimize>true</Optimize>
> <OutputPath>.\bin\Release\</OutputPath>
> <DefineConstants>TRACE</DefineConstants>//***DIFFERENT
> </PropertyGroup>
>
> I've never edited the file (Actually I haven't opened it.)
> I don't think there's a interface to modify it from VC#.
> I think something affected it.
> Has anyone experienced same thing?
>
> TIA.
> Sam
>[/color] |