1

I'm having trouble deploying a .NET application that works perfectly fine on localhost. The application is passed through TeamCity and then Octodeploy to be hosted on a server. When I navigate to a page that performs a query on the database, and submit that query, I get the following exception:

Could not load file or assembly 'System.ValueTuple, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

This occurs when Microsoft.EntityFrameworkCore tries to construct DbContext.

In Visual Studio, I have installed System.ValueTuple 4.5.0 through Nuget, but it shows in my references with a warning symbol and if I inspect properties, it's shows version 0.0.0.0. However the dll is in my packages folder inside a net461 folder. Furthermore it's also in my packages folder on Github so TeamCity/Octodeploy should also have access to it.

This is VS2017, and Net Framework 4.6.1. I do not have the option to upgrade to 4.7, where ValueTuple is included as default, and downgrading to 4.6 caused more problems.

How can I make the little warning disappear and the reference actually behave? Is there a way I can point to it's location in packages? Adding it as a reference doesn't seem to help. Adding automatic redirects to csproj doesn't seem to help. Uninstalling it doesn't help either, even though it works locally without it installed.

Packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net461" />
  <package id="bootstrap" version="3.0.0" targetFramework="net461" />
  <package id="jQuery" version="1.10.2" targetFramework="net461" />
  <package id="jQuery.Validation" version="1.11.1" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net461" />
  <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net461" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages.Data" version="3.2.7" targetFramework="net461" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore" version="2.2.6" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Abstractions" version="2.2.6" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Analyzers" version="2.2.6" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.Relational" version="2.2.6" targetFramework="net461" />
  <package id="Microsoft.EntityFrameworkCore.SqlServer" version="2.2.6" targetFramework="net461" />
  <package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration.Abstractions" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Configuration.Binder" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.DependencyInjection" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Abstractions" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Configuration" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Console" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Logging.Debug" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Options" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.Extensions.Primitives" version="3.0.0" targetFramework="net461" />
  <package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.3" targetFramework="net461" />
  <package id="Microsoft.Net.Compilers" version="3.4.0" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
  <package id="Modernizr" version="2.6.2" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net461" />
  <package id="Remotion.Linq" version="2.2.0" targetFramework="net461" />
  <package id="Respond" version="1.2.0" targetFramework="net461" />
  <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
  <package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net461" />
  <package id="System.Data.SqlClient" version="4.6.1" targetFramework="net461" />
  <package id="System.Diagnostics.DiagnosticSource" version="4.5.0" targetFramework="net461" />
  <package id="System.Interactive.Async" version="3.2.0" targetFramework="net461" />
  <package id="System.IO" version="4.3.0" targetFramework="net461" />
  <package id="System.Memory" version="4.5.2" targetFramework="net461" />
  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
  <package id="WebGrease" version="1.5.2" targetFramework="net461" />
</packages>

And csproj, on github with company info removed: https://github.com/jckuhl/temp/blob/master/temp.csproj

Jonathan Kuhl
  • 699
  • 9
  • 23
  • Hi,did you restore your package on TeamCity?Please refer to [this](https://blog.jetbrains.com/teamcity/2013/08/nuget-package-restore-with-teamcity/). – Mr Qian Dec 11 '19 at 09:33
  • Besides, when you install the nuget `System.ValueTuple 4.5.0` in the local Visual Studio, please try to [clean nuget caches](https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders#clearing-local-folders) and then install the package. In addition, please share the `packages.config`(if you used) and `xxx.csproj` which will be helpful. – Mr Qian Dec 11 '19 at 09:38
  • TeamCity Nuget Restore is step 3. Cleaning and reinstalling didn't seem to affect it. – Jonathan Kuhl Dec 11 '19 at 15:58
  • Does this answer your question? ['System.ValueTuple, Version=0.0.0.0 required for Add-Migration on .NET 4.6.1 Class Library](https://stackoverflow.com/questions/45978173/system-valuetuple-version-0-0-0-0-required-for-add-migration-on-net-4-6-1-cla) – Paddy Dec 11 '19 at 16:11
  • It does not, I've tried everything on that question – Jonathan Kuhl Dec 11 '19 at 21:06
  • l think you could try to use [BindRedirect](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element) to include the old version of `System.ValueTuple` in `web.config`. – Mr Qian Dec 13 '19 at 10:27
  • I have the very same issue. Could you fix it? – Proviste Sep 28 '20 at 21:22

0 Answers0