Quantcast
Channel: WE MOVED to github.com/nuget. This site is not monitored!
Viewing all articles
Browse latest Browse all 7612

Edited Issue: Ability to specify that targeting a given set of platforms should imply support for additional platforms [2926]

$
0
0
This feature would allow NuGet to be configured in such a way that a target framework of portable-AAA+BBB+CCC would also imply that platform XXX was supported, ie it would be treated the same as portable-AAA+BBB+CCC+XXX.

There are two reasons to support this. The first is that updates to VS may include updates to the portable profiles that add additional platforms to existing profiles. For example, in VS2012 RTM, Profile36 was equivalent to portable-win8+net4+sl4. But in the Windows Phone 8 SDK, it was updated to also support Windows Phone 8. If someone created a library targeting Profile36 and a corresponding NuGet package for it without the WP8 SDK installed, the package wouldn't specify that it supported Windows Phone 8, and thus would fail to install on machines that did have the WP8 SDK installed. So it would be useful to be able to tell NuGet that if a package targets portable-win8+net4+sl4, it also supports wp8.

The second reason is to make it easier to consume NuGet packages from a Portable Class Library project targeting MonoAndroid or MonoTouch. There's currently no official support for this, but it works pretty well after following the steps described here: http://slodge.blogspot.co.uk/2012/12/cross-platform-winrt-monodroid.html. Basically, you add additional XML files to one of the portable profile directories which specify that that profile supports MonoTouch and MonoDroid. Usually Profile104 is chosen for this, so it essentially becomes portable-win8+net45+SL4+wp71+monotouch+monoandroid instead of just portable-win8+net45+SL4+wp71. This lets Portable Class Libraries targeting this profile be referenced from MonoAndroid and MonoTouch projects.

The problem however, is that it then isn't possible to install most NuGet packages into the Portable Class Library project. For example, Json.NET supports portable-net40+sl4+wp7+win8, and would normally install successfully into Profile104. However, when Profile104 has been modified to also support MonoAndroid and MonoTouch, the Json.NET package now fails to install because it doesn't specify that it supports those platforms. The current workaround is to quit VS, remove the MonoAndroid/MonoTouch xml files from the portable profile directory, restart VS, and add the reference to the NuGet package. Then of course you need to quit VS again and put things back the way they were. This is pretty painful.

This could be solved by allowing rules to be specified in NuGet.config of the form "If a portable target is compatible with portable-net40+sl4+wp7+win8, then treat it as if it also supports MonoAndroid and MonoTouch."

A pull request for this functionality may be forthcoming (especially if it's likely to be accepted).

Viewing all articles
Browse latest Browse all 7612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>