首页 > 解决方案 > Visual Studio 在第一次运行时查找较旧的程序集版本

问题描述

Visual Studio 专业版 2017 版本 15.7.4

我有一个 Web 项目 (MVC),每当我从 Visual Studio 运行它时,它都会打开浏览器(我已经在 Chrome 和 IE 中复制了它)并显示以下错误:

Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

但是,如果我刷新浏览器,它会继续并按预期工作。从技术上讲,我可以解决它,但它已经变得烦人且耗时。我不知道发生了什么。

我已经尝试重新启动 VS 和 Windows(服务器 2012 r2),检查了 GAC(什么也没找到),我检查了我的项目中对 Owin 的所有引用,我没有看到任何引用 v2.1,我什至有一个绑定重定向我的 web.config

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
  </dependentAssembly>

我主要研究了如何修复我得到的那种错误异常,但我没有发现任何类似的东西,我猜在 VS 中有某种缓存或默认选项试图寻找旧版本第一次运行,但我不知道在哪里寻找它。

有任何想法吗?

标签: visual-studiovisual-studio-2017

解决方案


推荐阅读