Could not load file or assembly “System.ValueTuple, Version=0.0.0.0” or one of its dependencies

后端 未结 3 1226
渐次进展
渐次进展 2020-12-14 17:34

I tried to update my project to .NET Standard 2.0 and during testing I got catch an exception:

System.IO.FileLoadException: \'Could not load file or a

相关标签:
3条回答
  • 2020-12-14 17:46

    I've been wrestling with something similar - dll's in the bin folder of webapi2 sln after build. I've deleted a list of dll's and refreshed each time - the error moves on to a different dll. Finally, after deleting 8 dll's the site fires up correctly. My next step is to write a post-build script to delete these dll's from the bin folder. A bit of a hack but the elegant solution can come later.

    0 讨论(0)
  • 2020-12-14 17:52

    in my case after update dotnet framework from 4.6 to 4.7 problem solved

    0 讨论(0)
  • 2020-12-14 18:03

    I solved this problem by enabling Automatic Binding Redirection in my .NET Framework 4.7 project (that references .NET Standard 2.0 library). Binding redirection can be enabled by manually editing project's .csproj file and addind following snippet a child of Project element:

    <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
    

    Visual Studio then during build generates neccessary assembly redirections to project's app.config, similar to this:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ffffd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
      </dependentAssembly>
    </assemblyBinding>
    

    allowing correct assembly to be loaded.

    0 讨论(0)
提交回复
热议问题