【问题标题】:Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.ValueTuple, Version=4.0.2.0,加载程序集时出现异常:System.IO.FileNotFoundException:无法加载程序集'System.ValueTuple,版本 = 4.0.2.0,
【发布时间】:2017-11-21 07:53:41
【问题描述】:

我尝试使用 Microchart 将图表包含到我的 xamarin 表单应用程序中,并且在安装 Microchart 和 Microchart.forms nuggets 时,我无法再次构建我的项目,它给出了以下错误

严重性代码描述项目文件行抑制状态 加载程序集时出现错误异常:System.IO.FileNotFoundException:无法加载程序集“System.ValueTuple,Version=4.0.2.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51”。也许它在 Mono for Android 配置文件中不存在? 文件名:'System.ValueTuple.dll' 在 Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference 参考,ReaderParameters 参数) 在 Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 程序集,AssemblyDefinition 程序集,布尔顶级) 在 Xamarin.Android.Tasks.ResolveAssemblies.Execute() Xceed365m4.Droid C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1410
00

我安装了 System.ValueTuple,版本=4.4。请问我该如何解决这个问题?

【问题讨论】:

    标签: c# ios xamarin charts xamarin.forms


    【解决方案1】:

    我猜你正在使用 .net 框架 4.7 版。这是一个错误,更多信息参考,https://github.com/dotnet/standard/issues/476

    一种解决方法是在 app.config 中使用绑定重定向。

     <dependentAssembly>
            <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.4.0.0"/>
          </dependentAssembly>
    

    如果不尝试从您的解决方案中手动添加引用。 从 nuget 手动下载 System.ValueTuple 并从您的解决方案中引用此 dll。

    右键单击参考文件夹 -> 添加参考 -> 浏览位置 -> 添加它。 清理并构建。

    【讨论】:

    • @Hammed 谢谢。请问如何在 xamarin 表单项目中找到 app.config 文件
    【解决方案2】:

    我正在使用 Xamarin.Forms netstandard2.0 在 Windows 上工作,添加项目引用后出现类似的错误。

    我的解决方案是...将参考“System.Configuration.dll”(..Windows\Microsoft.NET\Framework64\v4.0.30319\System.Configuration.dll)添加到 .Net Standard 项目。

    【讨论】:

    • 谢谢@Sergio。这对我有用。就我而言,它缺少“System.IO.dll”。
    【解决方案3】:

    我遇到了类似的错误,结果发现我的机器上运行了一些僵尸构建进程。在没有打开 Visual Studio 的情况下运行了三个 MSBuild.exe。手动杀死它们,错误就消失了。

    【讨论】:

      【解决方案4】:

      经过大量搜索,我的解决方案是在我的系统上更新我的 .Net 框架

      【讨论】:

        【解决方案5】:

        我通过在web config 中添加以下行来修复

        <?xml version="1.0" encoding="utf-8"?>
        <!--
          For more information on how to configure your ASP.NET application, please visit
          https://go.microsoft.com/fwlink/?LinkId=301880
          -->
        <configuration>
            ..........
            <runtime>
                ...........
                <dependentAssembly>
                    <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
                    <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
              </dependentAssembly>
            </runtime>        
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-11-11
          • 2023-03-28
          • 1970-01-01
          • 2017-08-09
          • 2021-10-04
          • 1970-01-01
          相关资源
          最近更新 更多