使用 win8 应用程序和 Visual Studio 2013 的框架目标创建 Nuget 包

Create Nuget package with framework target for win8 app and Visual Studio 2013

我正在尝试为 x64 Win8 应用商店应用程序准备一个 NuGet 包。要求适用于 Visual Studio 2013,它目前支持(据我所知)NuGet 2.8.6。 所以我有一个这样的 .nuspec 文件:

<files>
    <file src="lib\netcore45\wwapi.dll" target="lib\netcore45\wwapi.dll" />
    <file src="lib\netcore45\wwapi.winmd" target="lib\netcore45\wwapi.winmd" />
    <file src="lib\portable-wpa81\wwapi.dll" target="lib\portable-wpa81\wwapi.dll" />
    <file src="lib\portable-wpa81\wwapi.winmd" target="lib\portable-wpa81\wwapi.winmd" />
    <file src="runtimes\win8-x64\native\wwapi.dll" target="runtimes\win8-x64\native\wwapi.dll" />
    <file src="runtimes\win8-x64\native\wwapi.winmd" target="runtimes\win8-x64\native\wwapi.winmd" />
</files>

我使用了这样的 References 元素:

<references>
        <group targetFramework=".NETCore4.5">
            <reference file="wwapi.winmd" />
        </group>
        <group targetFramework="portable-wpa81">
            <reference file="wwapi.winmd" />
        </group>
</references>

但是,位于 runtimes 文件夹下的库不会添加到我正在使用的 x64 目标项目中,因此不会构建。有没有办法使用以下配置实现此目的:

  1. Visual Studio 2013 年;
  2. Nuget 2.8.6;
  3. NuGet 目标框架名字对象;

我知道使用 PowerShell 脚本或为 x86 和 x64 使用不同的程序包,但我正在寻找类似于 NuGet 3.0 和 Win10 UAP 的解决方案。

使用构建文件夹实现自动选择 x86/x64 版本的 W8 库。这在 VS2013 中受支持,因为它已添加到 Nuget 2.5 中(请参阅Nuget 2.5 release notes:自动导入 msbuild 目标和道具文件)

基本上,解决方案包括在 build/.targets 添加一个文件,该文件引用了正确的 dll。

以下是一些有用的示例链接:link1 and link2