我无法部署在localhost上可以正常运行的.NET应用程序。该应用程序先通过TeamCity传递,然后通过Octodeploy传递给服务器。当我导航到对数据库执行查询的页面并提交该查询时,出现以下异常:
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)
当Microsoft.EntityFrameworkCore尝试构造DbContext
时会发生这种情况。
在Visual Studio中,我已经通过Nuget安装了System.ValueTuple 4.5.0,但它在我的引用中显示了警告符号,如果我检查属性,它会显示0.0.0.0版。但是,dll是在net461文件夹中的我的packages文件夹中。此外,它也位于Github上的我的packages文件夹中,因此TeamCity / Octodeploy也应该可以访问它。
这是VS2017和Net Framework 4.6.1。我没有选择升级到4.7(默认情况下包含ValueTuple)的选项,而降级到4.6会导致更多问题。
如何使小警告消失并且引用实际上起作用?有什么方法可以指向包装中的位置吗?将其添加为参考似乎没有帮助。向csproj添加自动重定向似乎没有帮助。卸载它也无济于事,即使未安装也可以在本地运行。
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>
还有csproj,在github上,公司信息已删除:https://github.com/jckuhl/temp/blob/master/temp.csproj