简体   繁体   English

在Xamarin.Forms中指定Windows Phone目标

[英]Specify Windows Phone targets in Xamarin.Forms

It seems, the Xamarin.Support forums are pretty dead, so I will try my luck reposting the question here, on StackOverflow (original: http://forums.xamarin.com/discussion/58083/specify-windows-phone-targets#latest ). 看来,Xamarin.Support论坛已经死了,所以我会在这里尝试尝试在StackOverflow上重新发布问题(原文为: http : //forums.xamarin.com/discussion/58083/specify-windows-phone-targets#最新 )。

I have a problem creating new Xamarin.Forms project. 我在创建新的Xamarin.Forms项目时遇到问题。

Until the last update, when creating a new Xamarin.Forms project (Blank App Xamarin.Forms Portable), I got the core project, Android, iOS, Win81, WinPhone81 and UWP (which is exactly what I desired). 直到最后一次更新,当创建一个新的Xamarin.Forms项目(空白应用程序Xamarin.Forms Portable)时,我得到了核心项目Android,iOS,Win81,WinPhone81和UWP(这正是我所需要的)。 However, since yesterday I keep getting core, Android, iOS and Windows 8.0 Silverlight projects. 但是,从昨天开始,我一直在获得Android,iOS和Windows 8.0 Silverlight项目的核心。

I tried to remove the Silverlight project manually and add reference to Windows8.1 and UWP projects. 我尝试手动删除Silverlight项目,并添加对Windows8.1和UWP项目的引用。 However, I was not able to change the targets of the PCL (the Core project) - it forced me to keep the support for Silverlight. 但是,我无法更改PCL(核心项目)的目标-它迫使我保留对Silverlight的支持。 (Actually, I was able to change the PCL targets after removing all Xamarin.Forms dependencies and then re-referencing them). (实际上,在删除所有Xamarin.Forms依赖项然后重新引用它们之后,我能够更改PCL目标)。

What happend? 发生了什么事? How do I specify the targets for the Windows platform? 如何指定Windows平台的目标?

I am using Xamarin for Visual Studio. 我正在使用Xamarin for Visual Studio。 Current Xamarin.VisualStudio version is 4.0. 当前的Xamarin.VisualStudio版本是4.0。 I was trying to create the new projects with both .NET 4.5 and 4.6 framework settings. 我试图使用.NET 4.5和4.6框架设置创建新项目。

PS: Not directly related to this question, but I am getting some weird JSON error (after re-targeting, an empty project.json file was created in the PCL library). PS:与这个问题没有直接关系,但是我收到一些奇怪的JSON错误(重新定位之后,在PCL库中创建了一个空的project.json文件)。 However, upon building the project, the application runs smoothly both on Android and Windows Phone (haven't tried it on iPhone, yet). 但是,构建项目后,该应用程序可以在Android和Windows Phone上流畅运行(尚未在iPhone上尝试过)。

You have to manually add UWP project. 您必须手动添加UWP项目。 Check out this page and in particular this one 签出此页面 ,尤其是这一

I'm on latest, Xamarin 4, in the Stable channel. 我最近在稳定频道中看到Xamarin 4。 Using VS 2015 on Win10 with UWP tools installed (this is an important option). 在安装了UWP工具的Win10上使用VS 2015(这是一个重要的选择)。 Just created a project now and got a prompt about which version of Win I wanted to use, 10.0 being my default option. 现在刚刚创建一个项目,并提示我要使用哪个Win版本,默认值为10.0。

When the prompt was up I only had an 8.1 project in the solution. 提示出现时,我在解决方案中只有一个8.1项目。

After the prompt an UWP project was created. 提示后,创建了一个UWP项目。

Does this differ from your experience? 这是否与您的经历不同?

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

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