简体   繁体   English

无法引用Net45版本的Microsoft.Owin Nuget软件包

[英]Cannot reference net45 version of Microsoft.Owin Nuget package

So a couple of hours ago, I asked this question on SO: Strange Microsoft.Owin DLL issue and Nuget 所以几个小时前,我在SO上问了这个问题: 奇怪的Microsoft.Owin DLL问题和Nuget

I cleaned deleted some DLLs that were in the bin folder of my ASP.NET website and checked into source control. 我清理了一些ASP.NET网站的bin文件夹中的DLL,并检入了源代码管理。 After this, I was getting an error running my website localhost: 之后,我在运行网站本地主机时遇到错误:

could not load type 'Microsoft.Owin.Security.AuthenticationDescription' from assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

I figured out that my project is now referencing the 4.0 version of Microsoft.Owin, if I copy the 4.5 version of Microsoft.Owin into the bin directory of my ASP.NET MVC project, the error is fixed. 我发现我的项目现在引用的是Microsoft.Owin的4.0版本,如果我将Microsoft.Owin的4.5版本复制到ASP.NET MVC项目的bin目录中,则此错误已得到解决。

So I need a reference to Microsoft.Owin in 所以我需要参考Microsoft.Owin

\packages\Microsoft.Owin.2.1.0\lib\net45

Currently my project reference is to: 目前,我的项目参考是:

\packages\Microsoft.Owin.2.1.0\lib\net40

No matter how many times I delete the reference to the net40 Microsoft.Owin.dll, close the project, reopen it, clean it, and than try Adding a new reference and browsing to \\packages\\Microsoft.Owin.2.1.0\\lib\\net45, I still get a reference to net40 version. 无论有多少次删除对net40 Microsoft.Owin.dll的引用,关闭项目,重新打开它,清理它,然后尝试添加新引用并浏览到\\ packages \\ Microsoft.Owin.2.1.0 \\ lib \\ net45,我仍然可以参考net40版本。

I have checked the packages.config: 我已经检查了packages.config:

  <package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />

The csproj file: csproj文件:

    <Reference Include="Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>

In my web.config: 在我的web.config中:

 <compilation debug="true" targetFramework="4.5">

The Target framework for the project in the project properties is 4.5 项目属性中项目的目标框架为4.5

I have uninstalled and reinstalled the Microsoft.Owin 2.1.0 Nuget package. 我已经卸载并重新安装了Microsoft.Owin 2.1.0 Nuget程序包。

I even tried copying the net45 Microsoft.Owin.dll into the net40 folder for the package which resulted in the error: 我什至尝试将net45 Microsoft.Owin.dll复制到该包的net40文件夹中,从而导致错误:

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

I am using Visual Studio 2012 with tools for Visual Studio 2013 installed, when I open the Package Manage Console, I believe this is the version of Nuget I have: Package Manager Console Host Version 2.8.50313.31 我在安装Visual Studio 2013的工具时使用Visual Studio 2012,当我打开软件包管理控制台时,我相信这是我拥有的Nuget版本:软件包管理器控制台主机版本2.8.50313.31

If I copy the net45 version into the bin of my ASP.NET MVC Project, my error is fixed 如果将net45版本复制到ASP.NET MVC项目的bin中,我的错误已修复

Where is the reference to Microsoft.Owin net40 in my packages.config, Web.config or csproj, its not there, everything points to net45 libs for my packages but Microsoft.Owin points to \\packages\\Microsoft.Owin.2.1.0\\lib\\net40 no matter what I do. 我的packages.config,Web.config或csproj中对Microsoft.Owin net40的引用在哪里,不存在,所有内容都指向我的软件包的net45库,但是Microsoft.Owin指向\\ packages \\ Microsoft.Owin.2.1.0 \\ lib \\ net40不管我做什么。

愚蠢的问题,但是您是否检查了项目目标框架是否与下载的软件包匹配?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 奇怪的Microsoft.Owin DLL问题和Nuget - Strange Microsoft.Owin DLL issue and Nuget &#39;Microsoft.Owin&#39;上的FileLoadException - FileLoadException on 'Microsoft.Owin' 无法安装软件包“ Microsoft.Owin 4.0.0”。 我无法将Microsoft.Owin软件包安装到.NETFramework项目中吗? - Could not install package 'Microsoft.Owin 4.0.0'. Am I not able to install Microsoft.Owin packages into a .NETFramework project? 我可以用 net45 安全地替换 nuget 包上的所有 net46 依赖项吗? - Can I safely replace all net46 dependencies on nuget packages with net45? 如何针对net45的类库(包)项目运行xunit测试? - How do I run xunit tests for a Class Library (Package) project targeting net45? 运行时错误:无法加载文件或程序集&#39;Microsoft.Owin,版本= 3.0.0.0…Azure移动服务 - Runtime error: Could not load file or assembly 'Microsoft.Owin, Version=3.0.0.0…Azure mobile services 使用 Microsoft.Owin 验证 SSL 证书 - Validate SSL certificates with Microsoft.Owin Microsoft MVC模板 - 完全信任Microsoft.Owin - 替代品 - Microsoft MVC Template - Full Trust Microsoft.Owin - alternatives 定位 net45 时的 System.Numerics - System.Numerics when targeting net45 找不到引用的组件“ Microsoft.Owin”,“ Microsoft.Owin.Security”,“ Microsoft.Owin.Security.Facebook”吗? - The referenced component 'Microsoft.Owin', 'Microsoft.Owin.Security', 'Microsoft.Owin.Security.Facebook' could not be found?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM