如何为MacOS Sierra设置Xamarin.Forms? [英] How to Set Up Xamarin.Forms for MacOS Sierra?

查看:120
本文介绍了如何为MacOS Sierra设置Xamarin.Forms?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio似乎很难启动,因此我想知道我的设置是否有问题.我当前正在使用:

  • macOS Sierra,版本10.12.6
  • Visual Studio(VS)for Mac(社区版),版本7.3.2(内部版本12)

设置新解决方案:

A(新项目):

  1. 选择多平台应用
  2. Xamarin.Forms 下,选择 Blank Forms App(C#)
  3. 选择下一步

B(配置空白表格应用,第1部分):

  1. 应用名称: ABCD
  2. 组织者标识符: com.WXYZ
  3. 目标平台:同时选择 Android iOS
  4. 共享代码:选择使用可移植类库使用XAML生成用户界面文件
  5. 选择下一步

C(配置空白表格应用,第2部分):

  1. 项目名称: ABCD
  2. 解决方案名称: ABCD
  3. 位置: [选择位置],选择在解决方案目录中创建项目目录.
  4. 版本控制:什么也不做
  5. Xamarin测试云:什么都不做
  6. 选择创建

立即,VS开始正在添加软件包... 过程.完成后,3个 Packages 文件夹将包含与Xamarin相关的各种文件,它们都是一个共同点: Xamarin.Forms .

作为测试,我右键单击 ABCD 解决方案文件夹,然后选择清洁ABCD .立刻,我受到了这样的攻击:

错误XF001:Xamarin.Forms目标已被多次导入. 请检查您的项目文件并删除重复的导入. (XF001)(ABCD)

为什么会这样?我曾尝试分别删除上述3个 Packages 文件夹中的每个 Xamarin.Forms 文件,但这没什么用.

右键单击错误消息,然后选择 Show Error Reference (从字面上看),直接将我带到搜索字词"XF001"的Google搜索结果页,该字词的帮助为0%.

我在做什么错了?

解决方案

我也遇到了这个问题.至少在Mac的Visual Studio中,这似乎是当前新项目"模板中的错误.

进入共享库的csproj文件所在的文件夹.使用记事本或类似工具对其进行编辑,然后在底部找到<import>节点.应该有一个与Xamarin有关的东西.删除此import节点,保存并打开/重新加载您的解决方案.

Visual Studio seems to be having a hard time starting up, so I'm wondering if there's anything wrong in my setting it up. I'm currently using:

  • macOS Sierra, version 10.12.6
  • Visual Studio (VS) for Mac (Community edition), version 7.3.2 (build 12)

Setting up New Solution:

A (New Project):

  1. select Multiplatform App
  2. under Xamarin.Forms, select Blank Forms App (C#)
  3. select Next

B (Configure your Blank Forms App, part 1):

  1. App Name: ABCD
  2. Organizer Identifier: com.WXYZ
  3. Target Platforms: select both Android and iOS
  4. Shared Code: select Use Portable Class Library and Use XAML for user interface files
  5. select Next

C (Configure your Blank Forms App, part 2):

  1. Project Name: ABCD
  2. Solution Name: ABCD
  3. Location: [choose location], select Create a project directory within the solution directory.
  4. Version Control: select nothing
  5. Xamarin Test Cloud: select nothing
  6. select Create

Immediately, VS begins the Adding packages... process. After it's done, the 3 Packages folders have a variety of Xamarin-related files, one of which they all have in common: Xamarin.Forms.

Just as a test, I right-click on ABCD solution folder and select Clean ABCD. Immediately, I get hit with this:

Error XF001: Xamarin.Forms targets have been imported multiple times. Please check your project file and remove the duplicate import(s). (XF001) (ABCD)

Why is this happening? I've tried separately deleting each of the Xamarin.Forms file in each of the aforementioned 3 Packages folders, but that did nothing good.

Right-clicking on the error message and selecting Show Error Reference literally just takes me to a Google Search result page for the search term "XF001", which helps 0%.

What am I doing wrong?

解决方案

I have encountered this as well. It seems like a bug in the current 'New Project' templates, at least in Visual Studio for Mac.

Go into the folder where the csproj file of your shared library is. edit it with Notepad or similar and find the <import> node(s) at the bottom. There should be one which has something relatable to Xamarin in it. Remove this import node, save it and open/reload your solution.

这篇关于如何为MacOS Sierra设置Xamarin.Forms?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆