looking @ mvvmcross.portablesupport.3.0.1.nuspec noticed there following line:
<file src="_._" target="lib\portable-win+net45+monoandroid16+monotouch40+sl40+wp71\_._" />.
i understand nuget creating list of supported frameworks list (win+...+sl40+wp71) , project library added must support 1 of frameworks. enumerates project types can added.
now if try install package portable project having profile49 work on windows since profile49 on windows net45+wp80.
however on mac profile49 net45+wp80+monoandroid10+monotouch10.
this means nuget package supported frameworks win+net45+monoandroid16+monotouch40+sl40+wp71 cannot installed on project of profile49 on mac since there frameworks having lower version (monotouch10 , monoandroid10).
could string portable-win+net45+monoandroid+monotouch+sl40+wp71 used on mvvmcross side instead? reason specific versions?
why profiles shipped xamarin (e.g. /library/frameworks/mono.framework/external/xbuild-frameworks/.netportable/v4.5/profile/profile49) include monotouch10 , monoandroid10?
thank insights.
update: if using alpha channel of xamarin studio there no longer need copy pcls windows. can use v4.0, profile158, works out of box async.
update: added instructions on how async work in pcl in article: xamarin studio mac, portable class library, async , android, go there after article if want work async in pcl.
a sort of working solution problem had mvvm+pcl+xamarin studio on mac work. see below details.
the steps below make things work android , pcl projects. ios projects xamarin studio on mac communicating targetframework of monotouch,version=v1.0 nuget. since mvvm packages contain +monotouch40 nuget refuses install packages on project. workaround add
<targetframeworkversion>v4.0</targetframeworkversion>
to .csproj, add packages nuget , set targetframeworkversion v1.0.
i have verified behaviour in visual studio. there project targetframework monotouch,version=v4.0 reported nuget plugin. why same packages work on visual studio not on xamarin studio mac. guess should corrected consistent.
steps
xamarin studio
- make sure use beta or alpha channel in xamarin studio under mac
- install nuget package manager: xamarin studio / add-in manager
install .netportable mono.framework
- copy .netportable (c:\program files (x86)\reference assemblies\microsoft\framework.netportable) folder windows pc mac
- place under /library/frameworks/mono.framework/external/xbuild-frameworks/.netportable/ (make sure not overwrite existing folder, in case gets shipped xamarin studio!!!) (see here also)
patch nuget
a patched fork can found here: https://nuget.codeplex.com/sourcecontrol/network/forks/takoyakich/nuget/latest, take 2.7 branch. if want patch yourself:
git clone https://git01.codeplex.com/nuget cd nuget git checkout -b 2.7 origin/2.7 patch -p1 < {patch file saved below} cd src/core xbuild cp bin/debug/nuget.core.dll ~/library/application\ support/xamarinstudio-4.0/localinstall/addins/monodevelop.packagemanagement.0.6/nuget.core.dll
restart xamarin studio if kept open.
test it!
- open xamarin studio
- create new portable library
- on project, go options, build/general should see dialog letting choose target frameworks (e.g. .net45+wp8 corresponds profile49)
- goto references, manage nuget packages, add mvvmcross
- follow 1 of @slodge 's excellent n+1 mvvmcross tutorial videos here ...
patch nuget.core.dll:
diff --git a/src/core/netportable/netportableprofiletable.cs b/src/core/netportable/netportableprofiletable.cs index 6f6a9ff..edc710c 100644 --- a/src/core/netportable/netportableprofiletable.cs +++ b/src/core/netportable/netportableprofiletable.cs @@ -49,16 +49,12 @@ namespace nuget private static netportableprofilecollection buildportableprofilecollection() { var profilecollection = new netportableprofilecollection(); - string portablerootdirectory = - path.combine( - environment.getfolderpath(environment.specialfolder.programfilesx86, environment.specialfolderoption.donotverify), - @"reference assemblies\microsoft\framework\.netportable"); - + string portablerootdirectory = getportablerootdirectory (); if (directory.exists(portablerootdirectory)) { foreach (string versiondir in directory.enumeratedirectories(portablerootdirectory, "v*", searchoption.topdirectoryonly)) { - string profilefilespath = versiondir + @"\profile\"; + string profilefilespath = path.combine(versiondir,"profile"); profilecollection.addrange(loadprofilesfromframework(profilefilespath)); } } @@ -66,6 +62,22 @@ namespace nuget return profilecollection; } + private static string getportablerootdirectory() + { + if (ismonoonmac ()) { + return "/library/frameworks/mono.framework/external/xbuild-frameworks/.netportable"; + } + return path.combine( + environment.getfolderpath(environment.specialfolder.programfilesx86, environment.specialfolderoption.donotverify), + @"reference assemblies\microsoft\framework\.netportable"); + } + + static bool ismonoonmac () + { + // environment.osversion.platform returns unix, didn't find better way :-( + return file.exists ("/system/library/coreservices/finder.app/contents/macos/finder"); + } + private static ienumerable<netportableprofile> loadprofilesfromframework(string profilefilespath) { if (directory.exists(profilefilespath))
Comments
Post a Comment