【发布时间】:2019-10-02 21:48:46
【问题描述】:
我有一个项目需要针对多个版本的 CefSharp(它是使用 CefSharp 并规定版本的父级的插件)。我的 .csproj 文件中使用对 NuGet 包的包引用有以下内容:
<PackageReference Include="cef.redist.x64" Condition="'$(Configuration)' == 'Debug 2020' Or '$(Configuration)' == '2020'">
<Version>3.3325.1758</Version>
</PackageReference>
<PackageReference Include="CefSharp.Common" Condition="'$(Configuration)' == 'Debug 2020' Or '$(Configuration)' == '2020'">
<Version>65.0.1</Version>
</PackageReference>
<PackageReference Include="CefSharp.Wpf" Condition="'$(Configuration)' == 'Debug 2020' Or '$(Configuration)' == '2020'">
<Version>65.0.1</Version>
</PackageReference>
<PackageReference Include="cef.redist.x64" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>3.2987.1601</Version>
</PackageReference>
<PackageReference Include="CefSharp.Common" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>57.0.0</Version>
</PackageReference>
<PackageReference Include="CefSharp.Wpf" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>57.0.0</Version>
</PackageReference>
当我在“调试 2017”配置中构建它时,它应该给我 57.0.0 版本,但我得到的是 65.0.1。如果我完全删除对 65 的引用,但对条件或构建配置不做任何事情,那么现在它看起来像这样:
<PackageReference Include="cef.redist.x64" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>3.2987.1601</Version>
</PackageReference>
<PackageReference Include="CefSharp.Common" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>57.0.0</Version>
</PackageReference>
<PackageReference Include="CefSharp.Wpf" Condition="'$(Configuration)' != 'Debug 2020' And '$(Configuration)' != '2020'">
<Version>57.0.0</Version>
</PackageReference>
我得到了 57 版。这很好,但对于 2020 年的构建,我需要它来引用 65.0.1...为什么它不遵守条件??
从逻辑上讲,根据第二个测试,v57 条件必须评估为 true,因为它在 v65 引用不存在时构建和输出。这会让我相信顶级的评估也是真实的,并且“获胜”给了我 v65。但是,条件语句是逻辑对立的并且互斥的,不是吗?那将意味着他们不能都是真的……我错过了什么?
编辑
只使用其中的 v65 引用(条件仍然存在)运行另一个测试,我确实在输出中得到 v65 dll...如何使用名为“Debug 2017”的配置评估为 true?
【问题讨论】:
标签: nuget cefsharp csproj nuget-package-restore