Bug 31223 - Nuspec target documention
Summary: Nuspec target documention
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Xamarin
Component: Multi-Platform ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: CraigD
URL:
Depends on:
Blocks:
 
Reported: 2015-06-18 10:53 UTC by Jeremy Kolb
Modified: 2015-06-24 18:10 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jeremy Kolb 2015-06-18 10:53:14 UTC
I never know what to specify for the target value in nuspec files to say what version the nuget package works with.  Please add some documentation specifying what to place for the target value.  I see things like target="lib/MonoAndroid403" but it would be nice if this was documented.  Does this mean the package works on Android 4.0.3+ or is this Xamarin v3 with Android API 3+?

Clarifying docs with a list of all possible values would rock.
Comment 1 Matt Ward 2015-06-18 12:10:58 UTC
The official NuGet docs have some information on this but they do not show any of the Xamarin ones, nor any of the newer frameworks added recently by Microsoft. 

https://docs.nuget.org/create/enforced-package-conventions

The main Xamarin target frameworks in use today are:

MonoAndroid
MonoTouch
Xamarin.iOS
Xamarin.Mac

MonoTouch = iOS Classic.
Xamarin.iOS = iOS Unified.
Xamarin.Mac = Xamarin.Mac mobile framework - which is based on the same framework used by Xamarin.iOS and Xamarin.Android.

A .nuspec file that targeted all these would look something like:

<files>
    <file src="Mac\bin\Release\*.dll" target="lib\Xamarin.Mac20" />
    <file src="iOS\bin\Release\*.dll" target="lib\Xamarin.iOS10" />
    <file src="Android\bin\Release\*.dll" target="lib\MonoAndroid10" />
    <file src="iOSClassic\bin\Release\*.dll" target="lib\MonoTouch10" />
</files>

The above ignores any portable class libraries.

Most .nuspec files specify the version number of the target framework but it is optional if your assembly works with all versions of that target framework. So if your target was "lib\MonoAndroid" this would mean it works with any version of MonoAndroid.

You can specify the version with a set of numbers without a decimal point or you can specify it using decimal points. Without the decimal point NuGet will just take each number and turn it into a version by inserting a '.' between each digit.

In the above "MonoAndroid10" means "MonoAndroid 1.0". This just means the project's target framework needs to be MonoAndroid version 1.0 or higher. The version is specified in the <TargetFrameworkVersion> element in the project file.

MonoAndroid403 => MonoAndroid 4.0.3
Xamarin.iOS10 => Xamarin.iOS 1.0
Xamarin.iOS1.0 => Xamarin.iOS 1.0
Comment 2 Jeremy Kolb 2015-06-18 15:28:52 UTC
So does MonoAndroid403 correspond to Android 4.0.3 or to Xamarin 4.0.3?
Comment 3 Matt Ward 2015-06-18 17:52:55 UTC
From the project's point of view it will correspond to the Android version your application is being compiled against.

From the docs:

http://developer.xamarin.com/guides/android/application_fundamentals/understanding_android_api_levels/#framework

"The target framework is the specific Android framework version (API level) that your app is compiled for at build time. The target framework setting communicates target API level information to Xamarin.Android for use at compile time"

For Xamarin's iOS and Mac it is the Xamarin framework version number.
Comment 4 CraigD 2015-06-24 18:10:38 UTC
I've converted this answer into a page on the website (which we'll expand in future with more info on building NuGet packages).

http://developer.xamarin.com/guides/cross-platform/advanced/nuget/

Thanks for the feedback (and Matt, thanks for the info!)