.Net 选择错误引用的程序集版本

发布于 2024-10-02 18:25:01 字数 2424 浏览 3 评论 0原文

我刚刚将一个现有项目复制到一台全新的机器上开始在其上进行开发,但我引用的程序集之一(碰巧是 telerik DLL)的版本遇到了问题。

该项目最初引用了旧版本的程序集(我们称之为 v1.0.0.0)。我的新机器安装了最新版本的程序集,所以我想我已经更新了它(我们称新版本为 v2.0.0.0)。

现在的问题是:如果我将旧的 v1.0.0.0 dll 复制到项目文件夹并将其添加为引用,则网站启动时不会出现问题。如果我删除该引用(并从系统中删除旧的 DLL)并添加新版本 (v2.0.0.0),该页面将显示以下异常:

无法加载文件或程序集 'XXXXXX,版本=1.0.0.0, 文化=中立, PublicKeyToken=121fae78165ba3d4' 或 它的依赖项之一。位于的 程序集的清单定义确实 与装配参考不匹配。 (HRESULT 异常:0x80131040)

显然,代码正在寻找过时的版本,但找不到它。但为什么?

我在解决方案文件夹中查找该版本号,但找不到任何参考。我仔细检查了 .csproj 文件的文本,发现版本正确显示了最新版本,并且 HintPath 正确显示了新 DLL 的路径。此外,因为我没有在系统上安装旧的 DLL,所以它不会出现在我的 GAC 中(尽管 v2.0.0.0 会出现,正如预期的那样)。

然后,我启用了融合日志查看器,试图找出它为什么要寻找旧版本,但没有运气:

Assembly Load Trace: The following information can be helpful to determine why the assembly 'XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4' could not be loaded.


=== Pre-bind state information ===
LOG: User = MyComp\me
LOG: DisplayName = XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4
 (Fully-specified)
LOG: Appbase = file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/
LOG: Initial PrivatePath = d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\bin
Calling assembly : WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX/XXXXXX.DLL.
LOG: Attempting download of new URL file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/bin/XXXXXX.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

它说它是从寻找旧程序集开始的。我尝试在网上找到解决方案,并看到类似的

为什么我的要寻找旧版本?我还可以在哪里搜索来找到这个错误的参考?

I just copied an existing project to a brand new machine to start developing on it and have run into a problem with the version of one of my referenced assemblies (a telerik DLL as it happens).

The project originally referenced an older version of the assembly (lets call it v1.0.0.0). My new machine has the latest version of the assembly installed, so I thought I'd updated it (lets call the new version v2.0.0.0).

Now here's the problem: If I copy the old v1.0.0.0 dll to the project folder and add it as a reference, the web site launches without a problem. If I delete that reference (and also delete the old DLL from my system) and add the new version (v2.0.0.0), the page shows the following exception:

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

Clearly, the code is looking for the out of date version and can't find it. But why?

I greped the solution folder for that version number and couldn't find a single reference. I double checked the text of the .csproj file and found the version correctly shows the latest version and the HintPath correctly shows the path to the new DLL. Furthermore, because I didn't install the old DLL on the system it doesn't show up in my GAC (though v2.0.0.0 does, as expected).

I then enabled the fusion log viewer to try to figure out why it's looking for that old version, but no luck:

Assembly Load Trace: The following information can be helpful to determine why the assembly 'XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4' could not be loaded.


=== Pre-bind state information ===
LOG: User = MyComp\me
LOG: DisplayName = XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4
 (Fully-specified)
LOG: Appbase = file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/
LOG: Initial PrivatePath = d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\bin
Calling assembly : WebApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: d:\My Documents\Visual Studio 2010\Projects\CoolProj\WebApp\web.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: XXXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=121fae78165ba3d4
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90233b18/10d54998/XXXXXX/XXXXXX.DLL.
LOG: Attempting download of new URL file:///d:/My Documents/Visual Studio 2010/Projects/CoolProj/WebApp/bin/XXXXXX.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

All it says it that it starts by looking for that old assembly. I have tried to find a solution online and saw this similar SO question, but it seems to be the exact opposite of my problem. That questioner's program was finding the wrong DLL instead of the referenced one. Whereas my problem is that the program is mysteriously looking for the wrong DLL and unable to find it when the right one can be found locally in the bin folder and in the GAC.

Why is mine looking for the old version? Where else can I search to find this bad reference?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(23

树深时见影 2024-10-09 18:25:01

我的猜测是您正在使用的另一个程序集正在引用旧的 dll。您是否熟悉正在使用的所有其他项目引用,并且其中是否有对 Telerik dll 的引用?

您可以像这样在 web.config 文件中添加绑定重定向吗?

<dependentAssembly>
 <assemblyIdentity name="Telerik" publicKeyToken="121fae78165ba3d4"/>
 <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>

My guess is that another assembly you are using is referencing the old dll. Are you familiar with all of the other project references being used and do any of them have a reference to the Telerik dlls?

Can you put in a binding redirect in your web.config file like this?

<dependentAssembly>
 <assemblyIdentity name="Telerik" publicKeyToken="121fae78165ba3d4"/>
 <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
叫思念不要吵 2024-10-09 18:25:01

我尝试了大部分答案,但仍然无法使其发挥作用。这对我有用:

右键单击参考 -> 属性 -> 将“特定版本”更改为 false。

在此处输入图像描述

希望这会有所帮助。

I tried most of the answers but still couldn't get it to work. This worked for me:

right click on reference -> properties -> change 'Specific Version' to false.

enter image description here

Hope this Helps.

蓝眼睛不忧郁 2024-10-09 18:25:01

我支持克里斯·康威(Chris Conway)(对他投了赞成票)。问题是您正在引用项目中的 telerik 程序集之一,而该程序集引用了另一个不存在的程序集。

第一件事:我不会在 GAC 中安装任何供应商(即 Telerik)程序集。 Telerik 的东西无论如何都被编译成两个程序集(telerik.web.design 和 telerik.web.ui)。只需将它们与应用程序一起部署即可。

其次,在每个 .proj 文件(如 .csproj)中,都会有一个 指向 Telerik.Web.UI 文件。这通常包含版本号。确保放入 bin 文件夹中的程序集与该版本匹配。

第三,确保所有项目都使用最新的程序集。还要确保他们从本地路径而不是 GAC 获取程序集。 (我真的很不喜欢 GAC。它给我参与的一些项目带来了无穷无尽的问题)。我们通常有一个“Assemblies”文件夹,所有项目都将其用于外部程序集引用。

第四,每次加载网站项目时,Visual Studio 都会自动搜索您的 gac,如果在 gac 中找到某些内容,则重新定位程序集位置。我不记得它是否曾经为网络应用程序项目做过这样的事情,但我已经很长时间没有遇到过这些问题了。这可能会在部署过程中导致类似的问题。

第五,您可以在 web.config 中重新绑定程序集的版本号。在 runtime/AssemblyBinding 部分,您可以使用类似以下内容的内容,它将 2008 年部署的每个 telerik 程序集向前推进,并将其指向一个非常特定的版本:

  <dependentAssembly>
    <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
    <bindingRedirect oldVersion="2008.0.0.0-2020.0.0.0" newVersion="2010.02.0713.35" />
  </dependentAssembly>

I'm with Chris Conway on this one (upvoted him). The problem is that you are referencing one of the telerik assemblies in your project which references another one that isn't there.

First thing: I wouldn't install ANY vendor (ie: telerik) assemblies into the GAC. Telerik's stuff is compiled down to just two assemblies anyway (telerik.web.design and telerik.web.ui). Just deploy those with the application.

Second, in each of your .proj files (like .csproj) there is going to be a <reference include..> which points to the Telerik.Web.UI file. This normally contains a version number. Make sure the assembly you put in the bin folder matches that version.

Third, make sure ALL of your projects use the latest assembly. Also make sure they are grabbing the assembly from a local path instead of the GAC. (I really really don't like the GAC. It has caused no end of issues on some projects I've been on). We typically have an "Assemblies" folder that all projects use for external assembly references.

Fourth, visual studio automatically searches your gac everytime a web site project is loaded and retargets the assembly locations if it finds something in the gac. I can't remember if it ever does this for web application projects, but I haven't had the issue in a long time with those. This can cause similar issues during deployment.

Fifth, you can rebind version numbers for assemblies in the web.config. In the runtime/assemblybinding section you can use something like the following which takes every telerik assembly deployed in 2008 forward and points it to a very particular version:

  <dependentAssembly>
    <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
    <bindingRedirect oldVersion="2008.0.0.0-2020.0.0.0" newVersion="2010.02.0713.35" />
  </dependentAssembly>
百思不得你姐 2024-10-09 18:25:01

尝试:

  • 清理临时项目文件
  • 清理构建和 obj 文件
  • 清理安装在以下位置的旧版本
    C:\Users\USERNAME\.nuget\packages\

这对我有用。

Try:

  • cleaning temporary project files
  • cleaning build and obj files
  • cleaning old versions installed at
    C:\Users\USERNAME\.nuget\packages\

That worked for me.

苯莒 2024-10-09 18:25:01

这并不是为什么的明确答案,但我们遇到了这个问题,以下是我们的情况以及解决方法:

开发 1:

解决方案包含引用 NuGet 包的项目 A 和引用项目 A 的 MVC 项目。启用 NuGet 包还原,然后更新了NuGet包。出现运行时错误,抱怨找不到 NuGet lib - 但错误是它正在寻找较旧的、未更新的版本。解决方案(这很荒谬):在调用项目 A 的 MVC 项目中的第一行代码上设置一个断点。使用 F11 进入。解决了——再也没有出现过问题。

开发 2:

相同的解决方案和项目,但解决方案中的神奇设置断点和步骤不起作用。到处寻找版本重定向或对此 Nuget 包的其他错误引用,删除包并重新安装它,擦除 bin、obj、Asp.Net Temp,但没有解决问题。最后,更名为项目A,运行MVC项目——修复。将其重命名回原来的名称,它保持不变。

我没有任何解释为什么它会起作用,但它确实让我们摆脱了严重的困境。

This isn't a clear answer as to why, but we had this problem, here's our circumstances and what solved it:

Dev 1:

Solution contains Project A referencing a NuGet Package, and an MVC project referencing Project A. Enabled NuGet Package Restore, then updated the NuGet package. Got a runtime error complaining the NuGet lib can't be found - but the error is it looking for the older, non-updated version. Solution (and this is ridiculous): Set a breakpoint on the first line of code in the MVC project that calls Project A. Step in with F11. Solved - never had a problem again.

Dev 2:

Same solution and projects, but the magic set breakpoint and step in solution doesn't work. Looked everywhere for version redirects or other bad references to this Nuget package, removed package and reinstalled it, wiped bin, obj, Asp.Net Temp, nothing solved it. Finally, renamed Project A, ran the MVC project - fixed. Renamed it back to its original name, it stayed fixed.

I don't have any explanation for why that worked, but it did get us out of a serious lurch.

恋竹姑娘 2024-10-09 18:25:01
  1. 转到 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
  2. 查找 machine.config 文件
  3. ,在记事本中打开,
  4. 找到冲突 dll
  5. 删除此文件并保存。

编译程序集

addassemble=dllName,Version=1.0.0000.0000 Culture=neutral,PublicKeyToken="QWEWQERWETERY"

程序集编译

对我有用。

  1. Go to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
  2. Find machine.config file
  3. open in notepad
  4. find conflict dll
  5. Remove this and save.

compilation assemblies

addassembly=dllName,Version=1.0.0000.0000 Culture=neutral,PublicKeyToken="QWEWQERWETERY"

assemblies compilation

works for me.

耶耶耶 2024-10-09 18:25:01

您在该解决方案中还有其他项目吗?(可能是另一个项目引用了旧版本)通常在 VS 中,dll 依赖项跨越解决方案中的所有项目。

Do you have any other projects in that solution ?(may be another project was referencing an old version) Usually in VS, dll dependency spans all projects in the solution.

音栖息无 2024-10-09 18:25:01

我遇到了类似的问题,我必须删除 bin 和 obj 文件夹中的所有内容并重建以解决我的问题。希望这有帮助。

I had a similar issue and I had to delete everything from the bin and obj folders and rebuild to get past my issue. Hope this helps.

も星光 2024-10-09 18:25:01

我的问题是旧程序集位于 Web 应用程序下的 _bin_deployableAssemblies 文件夹中。
这意味着旧程序集在构建项目时会覆盖 GAC 程序集。

My problem was that the old assemblies were in the _bin_deployableAssemblies folder under the Web Application.
This meant the old assemblies were overwriting the GAC assemblies when building the project.

长亭外,古道边 2024-10-09 18:25:01

万一可以为其他人节省 3 个小时……我的情况有点不同。我的代码使用DevExpress v11.1 v11.1.4.0。我在代码中正确引用了所有内容。但是.net内存分析器在GAC中安装了DevExpress v11.1 v11.1.12.0。事实上,失败的不是我引用的组件,而是他们内部引用的组件。尽管我尽了最大的努力,GAC 总是首先被检查。它编译并运行良好,但我无法查看 win 表单设计器,并且堆栈跟踪根本没有帮助。最后卸载了.net内存分析器,一切都恢复了。

In case is saves someone else 3 hours... my case was a bit different. My code used DevExpress v11.1 v11.1.4.0. I had it all referenced correctly in my code. But .net memory profiler installed DevExpress v11.1 v11.1.12.0 in the GAC. In fact it wasn't the components I referenced but the ones they referenced internally that failed. Try as I might, the GAC is always checked first. It compiled and ran fine but I couldn't view the win forms designer and the stack trace was no help at all. Finally uninstalled .net memory profiler and all was restored.

债姬 2024-10-09 18:25:01

这个错误有点误导 - 我正在加载一些需要指定 x64 架构的 DLL。在 .csproj 文件中:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-ABC|AnyCPU'">
    <OutputPath>bin\Release-ABC</OutputPath>
    <PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

缺少 PlatformTarget 导致此错误。

This error was somewhat misleading - I was loading some DLLs that required x64 architecture to be specified. In the .csproj file:

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-ABC|AnyCPU'">
    <OutputPath>bin\Release-ABC</OutputPath>
    <PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

A missing PlatformTarget caused this error.

淑女气质 2024-10-09 18:25:01

我得到:

无法加载文件或程序集“XXX-new-3.3.0.0”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)

这是因为我将程序集的名称从 XXX.dll 更改为 XXX-new-3.3.0.0.dll。将名称恢复为原始名称修复了错误。

I was getting:

Could not load file or assembly 'XXX-new-3.3.0.0' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It was because I changed the name of the assembly from XXX.dll to XXX-new-3.3.0.0.dll. Reverting name back to the original fixed the error.

说不完的你爱 2024-10-09 18:25:01

如果您在 Visual Studio 环境(ASP.NET 开发服务器)中测试和/或调试应用程序时遇到此问题,则有必要删除开发网站文件夹中的所有临时文件。要了解该文件夹的位置,请在 Windows 托盘图标上查找 ASP.NET Development Server 图标(它的标题应如下所示:ASP.NET Development Server - Port ####),右键单击该图标并选择“显示”细节;然后,物理路径字段会告诉您临时文件夹是什么,应该删除其中的所有项目才能解决问题。再次构建并运行网站,问题应该得到解决(同样,解决了开发环境)。

If you are experiencing this problem when testing and/or debugging the application from the Visual Studio environment (ASP.NET Development Server), it is necessary to delete all temporary files on the development website folder. To know where that folder is, look for the ASP.NET Development Server icon on the Windows tray icon (it should have a title like this: ASP.NET Development Server - Port ####), right click the icon and select Show Details; thn, the field Physical path will tell you what the temporary folder is, all items there should be deleted to solve the problem. Build and run again the website and the problem should be solved (again, solved for the Development Environment).

任谁 2024-10-09 18:25:01

我对引用不同版本的 Newtonsoft.json 的不同程序集遇到了同样的问题。对我有用的解决方案是从 Nuget 包管理器控制台运行 update-package 。

I had the same problem with different assemblies referencing different versions of Newtonsoft.json. The solution that worked for me was running update-package from Nuget Package Manager Console.

输什么也不输骨气 2024-10-09 18:25:01

这几乎就像你必须清除你的计算机才能摆脱旧的 dll。我已经尝试了上述所有操作,然后执行了额外的步骤,即删除计算机上 .DLL 文件的每个实例,并从应用程序中删除每个引用。然而,它仍然可以很好地编译,并且当它运行时,它可以很好地引用 dll 函数。我开始怀疑它是否是从某个网络驱动器引用它。

Its almost like you have to wipe out your computer to get rid of the old dll. I have already tried everything above and then I went the extra step of just deleting every instance of the .DLL file that was on my computer and removing every reference from the application. However, it still compiles just fine and when it runs it is referencing the dll functions just fine. I'm starting to wonder if it is referencing it from a network drive somehwere.

哎呦我呸! 2024-10-09 18:25:01

当在引用同一 DLL 的不同版本的应用程序的两个版本之间切换时,我收到了相同的消息。尽管我在不同的文件夹中进行测试,但我不小心将新版本复制到了旧版本上。

因此,首先要检查的是应用程序文件夹中引用的 DLL 的版本。万一。

I had the same message when switching between two versions of an application that referenced different versions of the same DLL. Although I was testing in different folders I accidentally copied the newer version over the older version.

So the first thing to check is the version of the referenced DLL in the application's folder. Just in case.

你的笑 2024-10-09 18:25:01

也许这有帮助,也可能没有帮助。我清理了调试和发布版本,然后重命名了 OBJ 文件夹。这终于让我明白了。前面的步骤基本上是项目删除引用并将它们添加回项目属性。

Maybe this helps or maybe not. I cleaned my debug and release versions then I renamed the OBJ folder. This finally got me thorugh. Previous steps were basically project removing references and them adding them back in at the project properties.

赠佳期 2024-10-09 18:25:01

在“我的 Visual Studio 2015”中,我确保有问题的 Visual Studio 项目的引用路径列表为空:

在此处输入图像描述

In My Visual Studio 2015, I ensured that the offending Visual Studio Project's Reference Paths List is empty:

enter image description here

你另情深 2024-10-09 18:25:01

这对我有用:

我在类库项目中使用 Microsoft.IdentityModel.Clients.ActiveDirectory 版本 3.19,但在实际的 ASP.NET Web 应用程序项目中只安装了版本 2.22。在 Web 应用程序项目中升级到 3.19 让我克服了错误。

This is what worked for me:

I was using the Microsoft.IdentityModel.Clients.ActiveDirectory version 3.19 in a class library project but only had version 2.22 installed in the actual ASP.NET Web Application project. Upgrading to 3.19 in the web app project got me past the error.

溺渁∝ 2024-10-09 18:25:01

就我而言,我有 3 个项目,1 个主项目和 2 个由主项目引用的子项目。所以我更新了主项目,省略了子项目。这就是冲突所在。在我更新了所有项目后,一切都工作正常。

In my case i had 3 projects, 1 main project and 2 sub projects referenced by main project.. So i updated the main project, leaving out sub project. That's where the conflict was. After i updated all my project everything worked just fine.

聆听风音 2024-10-09 18:25:01

在VS2017中,已经尝试了上述所有解决方案,但没有任何效果。我们使用 Azure DevOps 进行版本控制。

  1. 来自团队资源管理器>源代码管理资源管理器

“在此处输入图像描述”"

  1. 选择长期让您抓狂的项目

  2. 右键单击分支或解决方案> ;高级>获取特定版本

“在此处输入图像描述”

  1. 然后确保您已按照屏幕截图勾选了覆盖文件的复选框

在此处输入图像描述

In VS2017, have tried all the above solution but nothing works. We are using Azure devops for versioning.

  1. From the teams explorer > Source Control Explorer

enter image description here

  1. Select the project which driving you nuts for a long time

  2. Right click the branch or solution > Advanced > get specific version

enter image description here

  1. Then make sure You have ticked the checkbox of overwrite files as per screenshot

enter image description here

风情万种。 2024-10-09 18:25:01

就我而言,我不小心从 nuget 选择了错误版本的 Telerik 软件包,然后 nuget 将我引用的每个软件包替换为不正确的版本。然后它插入了一个指向错误版本的绑定重定向,这样即使我用正确的版本替换了所有内容,它仍然在寻找不正确的版本。

In my case, I accidentally chose the wrong version of the Telerik package from nuget, which nuget then replaced every package i referenced with the incorrect version. It then inserted a binding redirect to the incorrect version so that even after I replaced everything with the correct version, it was still looking for the incorrect version.

锦欢 2024-10-09 18:25:01

我懒洋洋地让 Visual Studio 的 Nuget 包管理器分两步为我解决了这个问题:

  1. 从 Web.config 中的 < assemblyBinding 中删除所有内容

  2. 在程序包管理器控制台中使用以下命令:

    添加绑定重定向

I lazily let Visual Studio's Nuget Package Manager resolve the thing for me in two steps:

  1. Remove all contents from <runtime><assemblyBinding in Web.config

  2. Use the following command in Package Manager Console:

    Add-BindingRedirect

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文