【问题标题】:Xamarin - using xbuild to build a project with xamarin componenet addedXamarin - 使用 xbuild 构建添加了 xamarin 组件的项目
【发布时间】:2014-04-02 11:42:05
【问题描述】:

Mac os x 上的 Xbuild [Xamarin Studio]

我正在尝试使用 xbuild 构建解决方案和(Visual Studio 项目文件)csproj。 此解决方案包含一个项目 - 该项目不是启动项目,并且引用了 Newtonsoft [使用 xamarin 组件添加] 请注意该组件标记为“包含在此项目中”。

解决方案和项目在 Xamarin 中构建良好,但是在删除整个解决方案及其文件时。现在使用团队城市下载项目,然后使用 Xbuild 构建相同的解决方案,项目都失败并显示以下错误消息:

我已经附加了错误消息的快照

    [18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/EvidenceNotRequired.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/PhotoEvidence.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Evidence/TextEvidence.cs(1,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/BoundedQuestion.cs(3,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/ExtendedInfoQuestion.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/InfoItem.cs(4,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/MultiResponseQuestion.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/Question.cs(11,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

[18:01:48]  [Step 3/4] ../../../../NESQuestionFramework/NESQuestionFramework/Model/Questions/QuestionSet.cs(2,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing an assembly reference?

Xbuild 会尝试 ValidateAndroidPackage 路径,但是它找不到 Newtonsoft.Json 包。

        Target _ValidateAndroidPackageProperties:

            GetAndroidPackageName Task

              ManifestFile: 

              AssemblyName: NESQuestionFramework

              PackageName: NESQuestionFramework.NESQuestionFramework

        Target _AndroidResolveAssemblyReferences:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: 警告:参考'Newtonsoft.Json'未解决

            For searchpath {CandidateAssemblyFiles}

            Warning: {CandidateAssemblyFiles} not supported currently

            For searchpath {HintPathFromItem}

            Considered ../../Components/json.net-4.5.11/lib/android/Newtonsoft.Json.dll, but it does not exist.

            For searchpath {TargetFrameworkDirectory}

            Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v4.0.3, assembly named 'Newtonsoft.Json' not found.

            Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0, assembly named 'Newtonsoft.Json' not found.

            Considered target framework dir /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v1.0/Facades/, assembly named 'Newtonsoft.Json' not found.

            For searchpath {PkgConfig}

            Considered Newtonsoft.Json, but could not find in any pkg-config files.

            For searchpath {GAC}

            Considered Newtonsoft.Json, but could not find in the GAC.

            For searchpath {RawFileName}

            Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/Newtonsoft.Json' as a file, but the file does not exist

            For searchpath bin/Debug/

            Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json' as a file, but the file does not exist

            Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json.exe' as a file, but the file does not exist

            Considered '/Users/admin/Downloads/TeamCity/buildAgent/work/b998b8d1d0b0ff61/NESTouch/NESTouch.Android/NESQuestionFramework.Android/NESQuestionFramework.Android/bin/Debug/Newtonsoft.Json.dll' as a file, but the file does not exist

解决这个问题的正确方法是什么。 目前,我正在强迫开发人员登录服务器并使用 xamarin studio [我相信确实下载 Newtonsoft] 手动构建解决方案,并在以后每次使用 xbuild 运行它。 非常感谢您的宝贵时间

拉杰什

【问题讨论】:

  • 根据日志,可以在../../Components/json.net-4.5.11/lib/android/Newtonsoft.Json.dll 找到Newtosoft.dll,所以确定该文件是否存在于该路径中?
  • 我有几乎相同的问题,更新到 json.net 6.0.2 现在当我尝试构建整个解决方案时会发生这种情况。如果我单独构建每个项目,它就可以工作。在我使用 6.0.1-beta1 之前。

标签: xamarin json.net xbuild


【解决方案1】:

这有点旧,但我们使用的是 nuget 的 json.net (newtonsoft) 这允许在解决方案上轻松运行 nuget restore。

作为一种解决方法,您可以从运行良好的 xamarin 工作室运行 mdtool(有一些限制)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    • 2019-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多