Project Level Conditional Compilation Constant

I get a conditional compilation constant at the project level when I try to build my VB.NET project. It reads:

project-level conditional compilation constant 'VB_VER=9.0,TARGET="exe",CONFIG="Debug",_MyType="Console",PLATFORM="AnyCPU",DEBUG;^^ ^^ TRACE' not valid: Character is not valid. 

I recently updated it to the latest version (from 2.0), and I have a feeling that this has something to do with it.

What does it mean? I do not know...

Here is my project file:

 <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectType>local</ProjectType> <ProjectVersion>7.10.3077</ProjectVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{5810CBEF-671E-4845-BBE3-BC3470C3EE18}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <AssemblyName>svchost</AssemblyName> <DefaultClientScript>JScript</DefaultClientScript> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultTargetSchema>IE50</DefaultTargetSchema> <DelaySign>false</DelaySign> <OutputType>Exe</OutputType> <FileUpgradeFlags> </FileUpgradeFlags> <MyType>Console</MyType> <UpgradeBackupLocation> </UpgradeBackupLocation> <OldToolsVersion>0.0</OldToolsVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> <UpdateEnabled>false</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> <StartupObject>Sub Main</StartupObject> <ApplicationManifest>My Project\app.manifest</ApplicationManifest> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>svchost.xml</DocumentationFile> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugSymbols>true</DebugSymbols> <NoStdLib>false</NoStdLib> <Optimize>false</Optimize> <WarningLevel>4</WarningLevel> <NoWarn>42016,42017,42018,42019,42032</NoWarn> <DebugType>full</DebugType> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>svchost.xml</DocumentationFile> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DefineConstants>TRACE</DefineConstants> <DebugSymbols>false</DebugSymbols> <NoStdLib>false</NoStdLib> <Optimize>true</Optimize> <WarningLevel>4</WarningLevel> <NoWarn>42016,42017,42018,42019,42032</NoWarn> <DebugType>none</DebugType> </PropertyGroup> <ItemGroup> <!-- Removed Files Here --> </ItemGroup> <ItemGroup> <!-- Removed Files Here --> </ItemGroup> <ItemGroup> <!-- Removed Files Here --> </ItemGroup> <ItemGroup> <!-- Removed Files Here --> </ItemGroup> <ItemGroup> <!-- Removed Files Here --> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" /> <PropertyGroup> <PreBuildEvent> </PreBuildEvent> <PostBuildEvent> </PostBuildEvent> </PropertyGroup> </Project> 
+4
source share
3 answers

I changed the DefineConstants tag in this block:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>svchost.xml</DocumentationFile> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DefineConstants>DEBUG;TRACE</DefineConstants> <DebugSymbols>true</DebugSymbols> <NoStdLib>false</NoStdLib> <Optimize>false</Optimize> <WarningLevel>4</WarningLevel> <NoWarn>42016,42017,42018,42019,42032</NoWarn> <DebugType>full</DebugType> </PropertyGroup> 

to

 <DefineConstants>DEBUG</DefineConstants> 

It worked like a charm!

+3
source

I have the same problem. But after I used "," as a separator between constants instead of ";", it worked.

So try only with "," (comma).

+3
source

In .vbproj files, you must separate the constants separated by commas, unlike the semicolons used in .csproj files. So if you want the DEBUG and TRACE flags, you want:

 <DefineConstants>DEBUG,TRACE</DefineConstants> 
+2
source

All Articles