简体   繁体   English

如何将Windows Phone项目添加到现有Xamarin.Forms项目

[英]how to add a windows phone project to existing Xamarin.Forms project

I created a Xamarin.Forms Shared project in Xamarin Studio, so it did not add iOS or windows Phone project so I added it from Visual Studio then I added Xamarin.Forms package from nuget to both project now when I try to add the shared library to both ios and winphone by right clicking on references and add references, under solution I don't see the shared library only droid library is visible 我在Xamarin Studio中创建了Xamarin.Forms共享项目,因此它没有添加iOS或Windows Phone项目,因此我从Visual Studio中添加了它,然后当我尝试添加共享库时,我从nuget中将Xamarin.Forms包添加到了两个项目中右键单击引用并添加引用,将其同时连接到ios和winphone,在解决方案下,我看不到共享库,只有droid库可见

i went through the Xamarin Docs i am following exactly what is written, what am i missing, or it is possible only in portable projects??? 我浏览了Xamarin文档,我正在严格按照所写内容,我所缺少的内容进行操作,或者仅在便携式项目中才有可能???

The easiest way to create a Xamarin.Forms solution is to create it from Visual Studio as Xamarin Studio doesn't support Windows Phone at all and iOS projects on Windows. 创建Xamarin.Forms解决方案的最简单方法是从Visual Studio创建它,因为Xamarin Studio根本不支持Windows Phone和Windows上的iOS项目。

In your case check if you have Windows Phone 8 SDK installed (not 8.1, not 7). 对于您的情况,请检查是否安装了Windows Phone 8 SDK(不是8.1,不是7)。 You can get it from this site . 您可以从此站点获取它。 Then create new Windows Phone 8 Silverlight project (again you will be asked to target 8.1 - no, you should target 8.0). 然后创建新的Windows Phone 8 Silverlight项目(同样,系统将要求您以8.1为目标-否,您应该以8.0为目标)。 Then add Xamarin.Forms nuget package. 然后添加Xamarin.Forms nuget包。

The best way to have shared code is to use Portable Class Library targeting Xamarin.Android, Xamarin.iOS and Windows Phone 8 (IMHO). 共享代码的最佳方法是使用针对Xamarin.Android,Xamarin.iOS和Windows Phone 8(IMHO)的可移植类库。

If all of these doesn't work, could you share your code? 如果所有这些都不起作用,您可以共享代码吗?

What version of Visual Studio are you using? 您正在使用哪个版本的Visual Studio? VS 2015 now has baked in support for add shared project references. VS 2015现在支持添加共享项目引用。 If you are using 2013 or lower, you need to download the visual studio extension to add shared project references. 如果您使用的是2013或更低版本,则需要下载Visual Studio扩展程序以添加共享的项目引用。 It will then be in the right-click context menu. 然后它将在右键单击上下文菜单中。

https://visualstudiogallery.msdn.microsoft.com/315c13a7-2787-4f57-bdf7-adae6ed54450 https://visualstudiogallery.msdn.microsoft.com/315c13a7-2787-4f57-bdf7-adae6ed54450

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM