如何处理 x86 与 x64 包 [英] How to deal with x86 vs x64 packages

查看:57
本文介绍了如何处理 x86 与 x64 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用 NuGet 来管理我们的第三方包.

We use NuGet to manage our third party packages.

我们还必须同时构建 x86x64 构建.

We also have to build both an x86 and x64 builds.

我们现在依赖于依赖于 C dll 的 NuGet 包 (zeromq),因此具有 x86>x64 发布.

We now have a dependency on a NuGet package (zeromq) that depends on a C dll and therefore has an x86 and x64 releases.

在 Nuget 中搜索时,我只看到两个不同的项目(zeromq x64 和 zeromq x86),而不是一个统一的项目.

When searching in Nuget I only see two distinct projects (zeromq x64 and zeromq x86) and not one unified project.

约束

我们在开发人员机器上的构建过程是在 Visual Studio 中选择适当的配置(即 Debug/x86、Release x64 等)并进行构建,因此我们使用的任何解决方案都必须适合 Visual Studio GUI(即 MSBuild 解决方案)不太适合我们当前的工作流程).

Our build process on the developers machines is to select the appropriate configuration(ie Debug/x86, Release x64, etc) in visual studio and build so any solution we use would have to fit into the visual studio GUI( ie MSBuild soltuions wouldn't' really fit our current workflow).

编辑

约束的附录....如果我们不能在 NuGet 中自动执行此操作,有没有办法使用某种 powershell 预构建脚本来执行此操作?即,如果我们知道我们正在构建 x86 版本,有没有办法挂钩 NuGet 以便它使用 x86 包而不是 x64 包?

Addendum to the constraint....If we can't do this automatically within NuGet, is there a way to do this with some sort of powershell prebuild script? ie if we know we are building the x86 build is there a way to hook NuGet so that it uses the x86 packaes instead of the x64 packages?

像这样管理 NuGet 包的正确方法是什么??

What is the proper way to manage NuGet Packages like this??

推荐答案

那么你有两种方法,

  • 创建您自己的 ZeroMQ 分支并关注 System.Data.SQLite.org 实现本地库预加载.然后你可以创建一个 NuGet 包而不是两个.

  • Create your own ZeroMQ fork and follow System.Data.SQLite.org to implement Native Library Pre-loading. Then you can create a single NuGet package instead of two.

为您的可执行文件创建两个项目(相同的源代码,只有两个项目文件).一个用于 x86,另一个用于 x64.将 ZeroMQ 的 x86 包添加到您的 x86 包,而 ZeroMQ 的 x64 包添加到您的 x64.它很丑陋,但 IHMO 可以避免在您的项目文件中进行调节(任何错误的 MSBuild 解析器都可以轻松破坏该文件).

Create two projects for your executable (the same source code, just two project files). One for x86 and the other for x64. Add ZeroMQ's x86 package to your x86 one, while ZeroMQ's x64 to your x64. It is ugly, but IHMO it avoids conditioning in your project file (which can be easily broken by any bad MSBuild parser).

这篇关于如何处理 x86 与 x64 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆