便携式类库错误创建的NuGet包 [英] Error creating NuGet package for Portable Class Library

查看:352
本文介绍了便携式类库错误创建的NuGet包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的NuGet,我想为对我已经创建另一个便携式类库包依赖便携式类库项目中创建的NuGet包。

I'm new to Nuget and I'm trying to create a NuGet package for a Portable Class Library project that has a package dependency on another portable class library I've created.

我运行到一个问题,我的项目文件时调用的的NuGet包收到一个错误的 TestComponent2.csproj (我创造了这个来自便携式的通用的应用程序模板中的VS 2013)。该库有从另一个PCL创建一个的NuGet程序包的相关名为 TestComponent1

I'm running into an issue where I'm receiving an error when calling nuget pack for the project file TestComponent2.csproj (I created this from the Portable for Universal Apps template in VS 2013). This library has a dependency on a nuget package created from another PCL called TestComponent1.

从未创建的包似乎包含这种依赖关系(控制台输出甚至说依赖关系:无)。然而,它是为packages.config文件中的 TestComponent2 项目的依赖肯定是上市:

The package created never seems to contain this dependency (the console output even says "Dependencies: None"). However it is in the packages.config file for the TestComponent2 project the dependency is definitely listed:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="TestComponent1" version="1.0" targetFramework="portable-win81+wpa81" />
</packages>

因此​​,在我的情况我打电话从一个名为TestComponent2项目在命令行下,从包含TestComponent2.csproj和packages.config的文件夹,用冗长打开:

So in my situation I'm calling the following from the command line for a project called TestComponent2, from the folder containing the TestComponent2.csproj and packages.config, with verbosity turned on:

> nuget pack TestComponent2.csproj -Verbosity Detailed

警告:无法从'TestComponent2.dll提取元数据。 警告信息:System.IO.FileNotFoundException:无法加载文件或程序集System.Runtime,版本= 4.0.10.0,文化=中性公钥= b03f5f7f11d50a3a或它的某一个依赖。该系统找不到指定的文件。 文件名:System.Runtime,版本= 4.0.10.0,文化=中性公钥= b03f5f7f11d50a3a'---> System.IO.FileNotFoundException:找不到无法加载文件或程序集System.Runtime,版本= 4.0.10.0,文化=中性公钥= b03f5f7f11d50a3a'  它的依赖或之一。该系统找不到指定的文件。 文件名:System.Runtime,版本= 4.0.10.0,文化=中性公钥= b03f5f7f11d50a3a'    在System.Reflection.RuntimeAssembly._nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection, 布尔燮pressSecurityChecks)    在System.Reflection.RuntimeAssembly.nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,B oolean燮pressSecurityChecks)

WARNING: Unable to extract metadata from 'TestComponent2.dll'. WARNING: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, B oolean suppressSecurityChecks)

...

添加文件mypath中\ TestComponent2.dll'打包为LIB \便携式-win81 + wpa81 \ TestComponent2.dll

Add file 'mypath\TestComponent2.dll' to package as 'lib\portable-win81+wpa81\TestComponent2.dll'

找到packages.config。使用列出的软件包作为依赖
警告:不指定描述了。使用描述。
警告:未指定作者是。使用MYNAME。

Found packages.config. Using packages listed as dependencies
WARNING: Description was not specified. Using 'Description'.
WARNING: Author was not specified. Using 'myname'.

编号:TestComponent2
版本:1.0 - 作者:MYNAME
说明:说明
依赖关系:无

Id: TestComponent2
Version: 1.0
Authors: myname
Description: Description
Dependencies: None

补充文件'的lib \便携式-win81 + wpa81 \ TestComponent2.dll。

Added file 'lib\portable-win81+wpa81\TestComponent2.dll'.

成功创建软件包mypath中\ TestComponent2.1.0.nupkg。

Successfully created package 'mypath\TestComponent2.1.0.nupkg'.

如果我称之为的NuGet规范第一我也得到了以下错误: 警告:无法从'TestComponent2.dll提取元数据。 使用TestComponent2.nuspec元数据。 替换标记'标题'没有价值。

If I call nuget spec first I also get the following error: WARNING: Unable to extract metadata from 'TestComponent2.dll'. Using 'TestComponent2.nuspec' for metadata. The replacement token 'title' has no value.

有一个问题的NuGet创建包为新的通用PCL?或者,也许我有一些配置错了吗?我使用的NuGet 2.8。

Is there an issue with nuget creating packages for the new universal PCL? Or perhaps I have some configuration wrong? I'm using Nuget 2.8.

推荐答案

它看起来像有是的NuGet 2.8 错误使其无法从PCL组件读取的元数据。

It looks like there is a bug in NuGet 2.8 causing it to fail to read the metadata from a PCL assembly.

我会建议你尝试的NuGet的旧版本,但不幸的是我认为你需要2.8.1由于您使用的是Windows Phone应用程序的目标(WPA),它仅支持2.8.1或以上。

I was going to suggest you try an older version of NuGet but unfortunately I think you need 2.8.1 since you are using the Windows Phone Application target (wpa) which is only supported in 2.8.1 or above.

一个解决方法是使用的NuGet包而不是使用项目文件YourNuSpecFile.nuspec。然而,你将需要投入更多的信息,在.nuspec得到这个工作。

A workaround would be to use nuget pack YourNuSpecFile.nuspec instead of using the project file. However you will need to put more information in the .nuspec to get this to work.

这篇关于便携式类库错误创建的NuGet包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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