项目级条件编译常量
我在尝试构建 VB.NET 项目时遇到项目级条件编译常量错误。 上面写着:
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.
我最近把它升级到了最新版本(从2.0),我感觉这和它有关系。
这是什么意思? 我一无所知...
这是我的项目文件:
<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>
I am getting a project-level conditional compilation constant error while trying 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 upgraded it to the latest version (from 2.0), and I have a feeling that this has something to do with it.
What does this mean? I am clueless...
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 .vbproj 文件中,您必须使用逗号分隔定义常量,这与 .csproj 文件中使用的分号不同。 因此,如果您想要 DEBUG 和 TRACE 标志,您需要:
In .vbproj files you must delimit define constants with commas, unlike the semicolons used in .csproj files. So if you want DEBUG and TRACE flags you want:
我有同样的问题。 但是当我使用“,”作为常量之间的分隔符而不是“;”之后,它起作用了。
因此,请尝试仅使用“,”(逗号)。
I had the same problem. But after I used "," as the separating character between constants instead of ";", it worked.
So have a try with "," (comma) only.
我将这个块中的 DefineConstants 标签更改为:
它
的效果非常好!
I changed the DefineConstants tag in this block:
to
It worked like a charm!