【发布时间】:2015-02-12 12:20:14
【问题描述】:
在 Visual Studio 2013 中,我有一个项目同时依赖于 MonoGame.Binaries NuGet 包和 OpenTK.GLControl 包。 OpenTK.GLControl 包本身依赖于 OpenTK 包。
MonoGame.Binaries 包含它自己的 OpenTK.dll 副本,而不是依赖于 OpenTK 包。结果,该 OpenTK.dll 正在覆盖构建时输出文件夹中 OpenTK 包中的 OpenTK.dll。这会破坏应用程序,因为 OpenTK.GLControl 需要包提供的不同版本的 OpenTK,而不是 MonoGame.Binaries 提供的任何版本的程序集。
如果他们需要的话,我怎样才能让两个依赖项相互配合,至少只使用他们自己的 OpenTK.dll 副本?
以下是 .csproj 中涉及引用的部分:
<ItemGroup>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.1.1.1589.5942\lib\NET40\OpenTK.dll</HintPath>
</Reference>
<Reference Include="OpenTK.GLControl, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\OpenTK.GLControl.1.1.1589.5942\lib\NET40\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MonoGame.Binaries.3.2.0\build\net40\MonoGame.Binaries.targets" Condition="Exists('..\packages\MonoGame.Binaries.3.2.0\build\net40\MonoGame.Binaries.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MonoGame.Binaries.3.2.0\build\net40\MonoGame.Binaries.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MonoGame.Binaries.3.2.0\build\net40\MonoGame.Binaries.targets'))" />
</Target>
【问题讨论】:
-
我想最近安装的会覆盖 dll。直到您将两个 dll 都安装到 GAC。
-
我尝试卸载,然后确保先重新安装 MonoGame.Binaries,然后再安装 OpenTK.GLControl。似乎没有什么不同,来自 MonoGame.Binaries 的 OpenTK.dll 在构建时继续“获胜”。
-
请发布您的 csproj 内部资料,特别是参考资料。
-
原帖中添加了相关位。
标签: visual-studio visual-studio-2013 nuget monogame opentk