我有兩個引用一個SQLite裝配,一個用於32位和一個64位,它看起來像這樣(這是一個測試項目,試圖擺脫的警告,不要在掛了路徑):.NET項目中的條件引用,有可能擺脫警告?
<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>
這將產生以下警告:
Warning 1 The referenced component 'System.Data.SQLite' could not be found.
是否有可能對我來說,擺脫這種警告?
我研究過的一種方法是在開發時將我的項目配置爲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>
,然後在我的參考:
<Reference Include="System.Data.SQLite">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(SqlitePath)\System.Data.SQLite.DLL</HintPath>
</Reference>
這擺脫了警告,但它是正確的?
我已經編輯我的答案跟我的想法是正確的,你可以看看它,並告訴我,如果這是你的意思? – 2010-04-06 10:26:37
@Lasse:這看起來是正確的。 – Richard 2010-04-06 11:22:02