简体   繁体   中英

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.ValueTuple, Version=4.0.2.0,

I tried to include chart to my xamarin forms app using Microchart and when in install the Microchart and Microchart.forms nuggets i cant build my project again it give the the following error

Severity Code Description Project File Line Suppression State Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Perhaps it doesn't exist in the Mono for Android profile? File name: 'System.ValueTuple.dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute() Xceed365m4.Droid C:\\Program Files (x86)\\MSBuild\\Xamarin\\Android\\Xamarin.Android.Common.targets 1410
00

I have System.ValueTuple, Version=4.4 installed. Please how can i fix this?

I guess you are using .net framework version 4.7.This is a bug,for more info refere, https://github.com/dotnet/standard/issues/476 .

A workaround is to use a binding redirect in 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>

If not try to add the reference manually from your solution. Download System.ValueTuple manually from nuget and refer to this dll from your solution.

Right click on the References folder -> Add Reference -> Browse Location -> Add it. Clean and build.

I'm working on Windows with Xamarin.Forms netstandard2.0 and I had some error like that after adding a project reference.

The solution for me was... adding the reference "System.Configuration.dll" (..Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\System.Configuration.dll) to the .Net Standard project.

I had a similar error, and it turned out I had some zombie build processes running on my machine. There were three MSBuild.exe's running without Visual Studio open. Killed them manually and the error went away.

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

I fixed by adding below line in 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>        

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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