ang*_*son 22 c# conditional reference project compiler-warnings
我有一个SQLite程序集的引用,一个用于32位,一个用于64位,看起来像这样(这是一个试图摆脱警告的测试项目,不要挂在路径上) :
<Reference Condition=" '$(Platform)' == 'x64' " Include="System.Data.SQLite, Version=1.0.61.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64">
<SpecificVersion>True</SpecificVersion>
<HintPath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\64-bit\System.Data.SQLite.DLL</HintPath>
</Reference>
<Reference Condition=" '$(Platform)' == 'x86' " Include="System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
<SpecificVersion>True</SpecificVersion>
<HintPath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\32-bit\System.Data.SQLite.DLL</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
这会产生以下警告:
Warning 1 The referenced component 'System.Data.SQLite' could not be found.
Run Code Online (Sandbox Code Playgroud)
我有可能摆脱这个警告吗?
我开发时只考虑将项目配置为32位的一种方法,让构建机器在构建64位时修复引用,但这看起来有点尴尬,可能容易出错.
还有其他选择吗?
我想摆脱它的原因是警告显然被TeamCity收集并定期标记为我需要调查的东西,所以我想完全摆脱它.
编辑:根据答案,我试过这个:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
...
<SqlitePath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\32-bit</SqlitePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
...
<SqlitePath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\32-bit</SqlitePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
...
<SqlitePath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\64-bit</SqlitePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
...
<SqlitePath>..\..\LVK Libraries\SQLite3\version_1.0.65.0\64-bit</SqlitePath>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
然后在我的参考:
<Reference Include="System.Data.SQLite">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SqlitePath)\System.Data.SQLite.DLL</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
这摆脱了警告,但这是正确的吗?