rev*_*.lt 9 xamarin.ios xamarin.android mvvmcross xamarin-studio
看着MvvmCross.PortableSupport.3.0.1.nuspec,我注意到有以下行:
<file src="_._" target="lib\portable-win+net45+MonoAndroid16+MonoTouch40+sl40+wp71\_._" />.
Run Code Online (Sandbox Code Playgroud)
我知道nuget正在从该列表中创建一个受支持的框架列表(win + ... + sl40 + wp71),并且添加此库的项目必须支持其中一个框架.基本上它枚举了可以添加它的项目类型.
现在,如果我尝试将此软件包安装到具有Profile49的可移植项目中,这将在Windows上运行,因为Windows上的Profile49是net45 + wp80.
然而在Mac上,Profile49是net45 + wp80 + MonoAndroid10 + MonoTouch10.
这意味着支持框架win + net45 + MonoAndroid16 + MonoTouch40 + sl40 + wp71的nuget软件包无法安装在Mac上的Profile49项目中,因为有较低版本的框架(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?
感谢您的见解.
rev*_*.lt 16
更新:如果您使用的是Xamarin Studio的Alpha通道,则不再需要从Windows复制PCL.您可以使用v4.0,Profile158,这也可以与Async一起使用.
更新:我在本文中添加了有关如何在PCL中使用异步的说明:Xamarin Studio Mac,可移植类库,Async和Android,所以如果您想在PCL中使用异步,请转到本文之后.
一个解决问题的工作方案我必须让Mvvm + PCL + Xamarin Studio在Mac上运行.请参阅下面的详细信息.
以下步骤使得Android和PCL项目的工作正常.对于iOS项目,Mac上的Xamarin Studio正在将MonoTouch的TargetFramework,Version = v1.0传递给Nuget.由于mvvm软件包包含+ MonoTouch40,因此Nuget拒绝在项目中安装软件包.解决方法是添加
Run Code Online (Sandbox Code Playgroud)<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
到.csproj,使用Nuget添加包并将TargetFrameworkVersion设置回v1.0.
我已经验证了Visual Studio中的行为.有一个项目使用TargetFramework MonoTouch,Version = v4.0被报告给Nuget插件.这就是为什么相同的包在Visual Studio上工作而不在Xamarin Studio Mac上.我想这应该纠正一致.
可以在这里找到修补的分支:https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget/latest,取2.7分支.如果你想修补自己:
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
Run Code Online (Sandbox Code Playgroud)
如果你打开它,请重新启动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))
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5083 次 |
最近记录: |