如何使用 nuget 运行时在同一包中针对不同的 CPU 架构? [英] How to use nuget runtimes to target different CPU architectures in the same package?

查看:25
本文介绍了如何使用 nuget 运行时在同一包中针对不同的 CPU 架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 UWP 创建一个 nuget 包,目标是单独的 CPU 架构构建(arm、x64、x86).我正在使用 nuget 3.3.0.阅读最新的

将包安装到 UWP 项目会添加依赖项,但不会添加对 lib 文件夹中程序集的引用,因此我无法使用这些内容.打包或安装包没有错误.

在互联网上搜索我发现了其他打包 CPU 架构特定构建的方法(最相关的:1, 2).所有这些似乎都针对旧的 nuget 版本 (<3.0.0).

运行时"是否是使用最新 nuget 版本解决此问题的正确方法?如果是,我做错了什么?

解决方案

参见 https://github.com/NuGet/Home/issues/1221.

总而言之,您必须将特定于架构的二进制文件放在 runtimes 文件夹中.此外,您需要将表面区域实现放置在 ref 文件夹中.诀窍是使用 corflags 命令为您的 ref 文件夹生成库.

I'm trying to create a nuget package for UWP targeting separate CPU architecture builds (arm, x64, x86). I'm using nuget 3.3.0. Reading latest nuget documentation, I understood that this can be achieved using "runtimes" folders.

This is package structure:

Installing the package to a UWP project adds the dependencies but it doesn't add references for assemblies from lib folders as a result I can't use the content. There are no errors packing or installing the package.

Searching on internet I found other ways to pack CPU architecture specific builds (most relevant ones: 1, 2). All of them seems to target old nuget versions (<3.0.0).

Are "runtimes" the right way to solve this problem with latest nuget version? If yes what am I doing wrong?

解决方案

See https://github.com/NuGet/Home/issues/1221.

In summary, you'll have to place your architecture specific binaries in the runtimes folder. In addition you need a surface area implementation to be placed in the ref folder. The trick is to use the corflags command to generate the library for your ref folder.

这篇关于如何使用 nuget 运行时在同一包中针对不同的 CPU 架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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