mrward/monodevelop-nuget-addin

PCL support on Xamarin Studio for Mac

Opened this issue · 10 comments

It would be nice, if the Nuget.Core.dll bundled with this project had support for PCL on Mono for Mac.
There is a pull request for nuget already:

https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget/contribution/5363

I was going to add support for PCL libraries in the addin based on the stackoverflow post which I assume was your post. I was waiting until we have some PCL support that ships with mono before adding support. When I tried mono 3.2 no PCL profile folders were available available.

The post you mention is from myself. In fact the Alpha channel of Xamarin Studio will install Mono 3.2.2 which has the PCL profiles under /Library/Frameworks/Mono.framework/Versions/3.2.2/lib/mono/xbuild-frameworks/.NETPortable.

Any news ? Now the patch does not work with Mono 3.2.3 (Stable) with an error saying the profile was already added. Will check more today.

There is a new pull request:
https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget/contribution/5382
Unfortunately 2.6, 2.7 are closed and pull request will only apply to master.
I noticed that the HEAD of 2.7 has some issues on Mono, here is the change: https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget/changeset/40a211867332579188fedf1419826e031be9a62d
I don't remember if the error message was "profile already added", if you take branch 2.7 from here: https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget
it should work.

Does current addin work with newest nuget ? I remember I had some issues in the past.
Thanks by the way :)

I'm using 0.6 with a patched nuget core 2.7 from the fork above, compiled on 3.2.0.0 and using it on the stable channel of Xamarin Studio with the PCLs from Windows right now. I had a quick try with the Alpha Channel and a version of Nuget compiled under gmcs 3.2.3.0, it miserably crashes right now. It looks like a bug in Mono since the runtime crashes.

Nicely done :)
I was just lazy to do that

Bora Gonul
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Monday, September 23, 2013 at 4:40 PM, takoyakich wrote:

https://bugzilla.xamarin.com/show_bug.cgi?id=14926

I'm now using https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget (branch 2.7)
I get "An element with the same key already exists in the dictionary" exception while Nuget downloads files now.
Any idea ?

The "An element with the same key already exists in the dictionary" exception is because on the Mac there are two PCL profiles (Profile7 and ProfileXI7) that have the same set of supported frameworks. NuGet expects every profile to support a different set of frameworks.

Version 0.7 of the addin should now work with PCL libraries and also addresses the dictionary exception problem. Adding a NuGet package with PCL assemblies into a project that is targeting a PCL profile should now work, as long as the profiles are compatible.

NuGet has been patched to find PCL profiles on Linux and Mac. It follows the behaviour of xbuild when trying to locate the PCL profiles:

https://github.com/mono/mono/blob/master/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs

The following directories are checked in the following order.

  1. Paths defined in the environment variable $XBUILD_FRAMEWORK_FOLDERS_PATH with the .NETPortable directory appended.
  2. /Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable on Mac only
  3. $prefix/lib/mono/xbuild-frameworks/.NETPortable

NuGet has also been changed to make the Mono supported frameworks of a PCL optional. The mono frameworks are used when checking compatibility only if both the NuGet package and the local machine have Mono supported frameworks. It looks like NuGet 2.7.2 will have a fix for this so hopefully I can revert the workaround I added and use the fix the NuGet team have added:

https://nuget.codeplex.com/workitem/2926