NuGet和可移植类库-包不针对任何框架 [英] NuGet and Portable Class Libraries - Package doesn't target any framework

查看:78
本文介绍了NuGet和可移植类库-包不针对任何框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月来我一直在使用NuGet来管理内部创建的程序集,并且运行良好.我最近发现"了可移植类库,该类库也很棒,直到需要安装软件包为止.

I have been using NuGet to manage my internally created assemblies for a few months, and it's working very well. I recently 'discovered' portable class libraries, which has also been great - until it's time to install the packages.

说我有一个针对Windows Store应用程序的.NET 4.5,SL5和.NET的PCL.我运行nuget spec创建.nuspec文件,编辑值,将其打包,然后将.nupkg添加到内部供稿中.如果在程序包资源管理器中打开.nupkg文件,则会在lib下看到一个名为Portable-win + net45 + sl50的内容文件夹.

Say I have a PCL that targets .NET 4.5, SL5 and .NET for Windows Store Apps. I run nuget spec to create the .nuspec file, edit the values, package it up, and add the .nupkg to our internal feed. If I open the .nupkg file in the Package Explorer, I see one content folder under lib called portable-win+net45+sl50.

当我尝试从另一个解决方案中的任何兼容项目安装软件包时,收到以下消息:

When I try to install the package from any compatible project in another solution, I get the following message:

无法安装'Project.PCL',因为它与解决方案中的任何项目都不兼容.该软件包不针对任何框架."

"'Project.PCL' could not be installed because it is not compatible with any project in the solution. The package doesn't target any framework."

如果我在程序包资源管理器中手动创建.nupkg,更新版本号,为每个目标框架添加一个lib文件夹(而不是可移植文件夹),并将Project.PCL.dll添加到每个文件夹,则可以添加打包到解决方案中的兼容项目.但是每次我要更新PCl时都要执行此过程有些繁琐(我已经在项目根文件夹中创建了一个.cmd文件来快速打包和部署).

If I manually create the .nupkg in the Package Explorer, updating the version number, adding a lib folder for each targeted framework (not a portable folder) and added the Project.PCL.dll to each folder, I can add the package to the compatible projects in the solution. But to do this process every time I want to update a PCl is somewhat tedious (I had been creating a little .cmd file in the project root folder to quickly package and deploy).

其他人有这个问题吗?如何以与其他类型的项目相同的方式打包PCL?

Do other people have this problem? How can I package PCL's in the same way as other types of projects?

注意-我正在使用VS 2012 Ultimate和NuGet 2.2

Note - I'm using VS 2012 Ultimate and NuGet 2.2

推荐答案

听起来nuget spec不适用于可移植类库-值得启动线程或在

It sounds like maybe nuget spec doesn't work for Portable Class Libraries - that's worth starting a thread or filing an issue on the NuGet site.

但是,您也可以从NuGet软件包资源管理器中创建.nuspec文件.只需按照已创建的方式创建包,然后选择将元数据另存为..."将其另存为.nuspec.之后,您可能需要手动编辑nuspec文件中的源路径,但是您应该能够自动创建包.

However, you can also create a .nuspec file from NuGet Package Explorer. Just create the package as you already did, but then choose "Save Metadata As..." to save it as a .nuspec. Afterwards you may need to edit the source paths in the nuspec file manually, but you should be able to automate the creation of the package.

这篇关于NuGet和可移植类库-包不针对任何框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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