Xamarin.ios 让PCL、Mvvmcross、Nuget和Xamarin工作室播放;“尼斯”;在Mac上
查看MvvmCross.PortableSupport.3.0.1.nuspec 我注意到有以下几行:Xamarin.ios 让PCL、Mvvmcross、Nuget和Xamarin工作室播放;“尼斯”;在Mac上,xamarin.ios,xamarin.android,mvvmcross,xamarin-studio,Xamarin.ios,Xamarin.android,Mvvmcross,Xamarin Studio,查看MvvmCross.PortableSupport.3.0.1.nuspec 我注意到有以下几行: <file src="_._" target="lib\portable-win+net45+MonoAndroid16+MonoTouch40+sl40+wp71\_._" />. 。 我知道nuget正在从该列表(win+…+sl40+wp71)创建一个受支持框架的列表,并且添加该库的项目必须支持其中一个框架。基本上,它列举了可以添加到其中的项目类型 现在,如果我尝试将这个
<file src="_._" target="lib\portable-win+net45+MonoAndroid16+MonoTouch40+sl40+wp71\_._" />.
。
我知道nuget正在从该列表(win+…+sl40+wp71)创建一个受支持框架的列表,并且添加该库的项目必须支持其中一个框架。基本上,它列举了可以添加到其中的项目类型
现在,如果我尝试将这个包安装到一个带有Profile49的可移植项目中,这将在Windows上起作用,因为Windows上的Profile49是net45+wp80
但是在Mac上,Profile49是net45+wp80+MonoAndroid10+MonoTouch10
这意味着不能在Mac上Profile49的项目上安装带有受支持框架win+net45+MonoAndroid16+MonoTouch40+sl40+wp71的nuget软件包,因为有些框架的版本较低(MonoTouch10和MonoAndroid10)
- mvvmcross端是否可以使用字符串portable win+net45+MonoAndroid+MonoTouch+sl40+wp71?具体版本有什么原因吗
- 为什么Xamarin附带的配置文件(例如/Library/Frameworks/Mono.framework/External/xbuild Frameworks/.NETPortable/v4.5/Profile/Profile49)包括MonoTouch10和MonoAndroid10
感谢您的见解。更新:如果您正在使用Xamarin Studio的Alpha频道,则不再需要从Windows复制PCL。您可以使用v4.0、Profile158,这也适用于异步 更新:我在本文中添加了有关如何使异步在PCL中工作的说明:,因此,如果您想在PCL中使用异步,请在本文之后转到这里 一种解决问题的有效方法,我必须让Mac上的Mvvm+PCL+Xamarin Studio正常工作。详情见下文 下面的步骤使Android和PCL项目能够正常工作。对于iOS项目,Mac上的Xamarin Studio正在向Nuget传输MonoTouch的TargetFramework,版本=v1.0。由于mvvm软件包包含+MonoTouch40,Nuget拒绝在项目上安装这些软件包。解决方法是添加
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
v4.0
在.csproj中,添加带有Nuget的包,并将TargetFrameworkVersion设置回v1.0
我已经在Visual Studio中验证了该行为。有一个带有TargetFramework MonoTouch的项目,版本=v4.0,报告给Nuget插件。这就是为什么相同的包可以在VisualStudio上工作,而不能在Xamarin Studio Mac上工作。我想这应该是一致的
台阶
沙马林工作室
git clone https://git01.codeplex.com/nuget
cd nuget
git checkout -b 2.7 origin/2.7
patch -p1 < {patch file saved from 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
git克隆https://git01.codeplex.com/nuget
光碟
git签出-b 2.7源代码/2.7
修补程序-p1<{从下面保存的修补程序文件}
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
如果Xamarin Studio保持打开状态,请重新启动它
试试看!
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 a better way :-(
+ return File.Exists ("/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder");
+ }
+
private static IEnumerable<NetPortableProfile> LoadProfilesFromFramework(string profileFilesPath)
{
if (Directory.Exists(profileFilesPath))
diff——git a/src/Core/NETPortable/NetPortableProfileTable.cs b/src/Core/NETPortable/NetPortableProfileTable.cs
索引6f6a9ff..edc710c 100644
---a/src/Core/NETPortable/NetPortableProfileTable.cs
+++b/src/Core/NETPortable/NetPortableProfileTable.cs
@@-49,16+49,12@@namespace numget
私有静态NetPortableProfileCollection BuildPortableProfileCollection()
{
var profileCollection=new NetPortableProfileCollection();
-字符串可移植根目录=
-路径。联合收割机(
-Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86,Environment.SpecialFolderOption.DoNotVerify),
-@“引用程序集\Microsoft\Framework\.NETPortable”);
-
+字符串portableRootDirectory=GetPortableRootDirectory();
if(Directory.Exists(portableRootDirectory))
{
foreach(Directory.EnumerateDirectory中的字符串versionDir(portableRootDirectory,“v*”,SearchOption.TopDirectoryOnly))
{
-字符串profilefilepath=versionDir+@“\Profile\”;
+字符串profilefilepath=Path.Combine(versionDir,“Profile”);
AddRange(LoadProfilesFromFramework(ProfileFilePath));
}
}
@@-66,6+62,22@@namespace numget
回收;
}
+私有静态字符串GetPortableRootDirectory()
+ {