【问题标题】:Xamarin not found未找到 Xamarin
【发布时间】:2016-07-27 16:37:14
【问题描述】:

我在编译代码时遇到了问题。代码运行成功,我将其上传到 Team Foundation Server。但是,当人们(包括我自己)从 Team Foundation Server 下载代码时,代码产生了错误:

“错误 CS0246 找不到类型或命名空间名称“Xamarin”(是否缺少 using 指令或程序集引用?)”

我有最新版本的 Xamarin.Forms。

代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Xamarin.Forms;

namespace XamlSamples
{
        public class App : Application
    {
        public App()
        {
            // The root page of your application
            MainPage = new HelloXamlPage();
        }        
            };
        }

【问题讨论】:

  • 检查项目的 References - 是否有对 Xamarin 的有效引用?
  • Xamarin 有 3 个引用:Xamarin.Forms.Core、Xamarin.Forms.Platform 和 Xamarin.Forms.Xaml。在属性上,它们都具有 Copy Local= False,而我的本地副本具有 Copy Local= True。我怎样才能解决这个问题?我尝试将 False 更改为 True,但它只是切换回来了。
  • 尝试从 Nuget 恢复 Xamarin.Forms 以查看您的问题是否仍然存在。

标签: c# tfs xamarin.ios


【解决方案1】:

检查您是否在 Visual Studio 中启用了自动包还原(还原 Xamarin.forms)。进入Tools--Options--Nuget Package Manager--General,勾选以下项目:

  • 允许 NuGet 下载缺失的包
  • 在 Visual Studio 中构建期间自动检查丢失的包

【讨论】:

  • Xamarin 不是 NuGet 包。
  • @EvilTak,仔细检查一下,如果项目找不到 Xamarin.Forms 会导致这个错误。
  • 归咎于错误信息。如果 Xamarin.Forms 作为 NuGet 包 包含在原始项目中,这将起作用。
  • 我已通过 Nuget 更新到最新版本的 Xamarin.Forms,但它仍然不适合我。
猜你喜欢
  • 2017-10-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-11
  • 2023-03-06
  • 1970-01-01
  • 2021-05-13
  • 1970-01-01
相关资源
最近更新 更多