Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet and Portable Class Libraries - Package doesn't target any framework

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.

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' could not be installed because it is not compatible with any project in the solution. The package doesn't target any framework."

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).

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

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

like image 484
Alyce Avatar asked Oct 21 '22 21:10

Alyce


1 Answers

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.

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.

like image 95
Daniel Plaisted Avatar answered Oct 25 '22 18:10

Daniel Plaisted