奇怪的Microsoft.Owin DLL问题,的NuGet [英] Strange Microsoft.Owin DLL issue and Nuget
问题描述
于是,我清理了在ASP.NET MVC项目中的某些DLL引用,我删除了bin中的DLL和更新的源代码控制,从源头控制删除DLL文件。我的所有引用复制到bin在现在构建,以正确的方式。但是,当我运行本地主机我得到的错误:
So I cleaned up some DLL references in an ASP.NET MVC project, I deleted the DLLs in the bin and updated source control to remove the DLLs from source control. I copy all the references to bin on build now, the right way. But when I run localhost I get the error:
Could not load type 'Microsoft.Owin.Security.AuthenticationDescription' from assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
于是我开始在服务器(该网站工作)在比较的DLL,我的本地bin目录。如果我复制并更换服务器Microsoft.Own并覆盖我的本地版本,该网站再次工作,错误消失了。
So I started comparing DLLs on the server (where the website is working), to my local bin directory. If I copy and replace Microsoft.Own from the server and overwrite my local version, the website works again, error gone.
的东西是dll的版本是完全一样的,请参见下面的屏幕截图:
在左边是我的本地副本,而右边是来自服务器的版本
On the left is my local copy, and on the right is the version from the server.
如果我看我的参考ASP.NET MVC网站,我看到Microsoft.Own位于:
.. \\包\\ Microsoft.Owin.2.1.0 \\ lib中** ** net40 \\ Microsoft.Owin.dll
If I look at my References for the ASP.NET MVC Website, I see that Microsoft.Own is located at: ..\packages\Microsoft.Owin.2.1.0\lib**net40**\Microsoft.Owin.dll
和复制本地设置为True,见截图:
And Copy Local is set to True, see screen shot:
所以下次我删除了Microsoft.Owin.2.1.0参考,并尝试使用Microsoft.Owin.dll的net45版本而不是重新进行添加。所以,我浏览到的.. \\包\\ Microsoft.Owin.2.1.0 \\ lib中** ** net45 \\ Microsoft.Owin.dll
So next I deleted the reference for Microsoft.Owin.2.1.0 and tried to readd using the net45 version of Microsoft.Owin.dll instead. So I browsed to ..\packages\Microsoft.Owin.2.1.0\lib**net45**\Microsoft.Owin.dll
但是,当我去检查Microsoft.Owin属性,参考下,路径仍
.. \\包\\ Microsoft.Owin.2.1.0 \\ lib中** ** net40 \\ Microsoft.Owin.dll
But when I went to check the Properties for Microsoft.Owin, under References, the path was still ..\packages\Microsoft.Owin.2.1.0\lib**net40**\Microsoft.Owin.dll
所以我后来去我的csproj文件,看到以下条目:
So I then went to my csproj file and saw the following entry:
<Reference Include="Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.Security.2.1.0\lib\net45\Microsoft.Owin.Security.dll</HintPath>
</Reference>
和在我的web.config我targetFramework为4.5:
And in my web.config my targetFramework is 4.5:
<compilation debug="true" targetFramework="4.5">
所以最后,我复制并粘贴Microsoft.Owin.dll在服务器上,该工程
.. \\包\\ Microsoft.Owin.2.1.0 \\ lib中** ** net40 \\ Microsoft.Owin.dll和.. \\包\\ Microsoft.Owin.2.1.0 \\ lib中** ** net45 \\ Microsoft.Owin。 DLL
So finally, I copied and pasted the Microsoft.Owin.dll on the server, that works to ..\packages\Microsoft.Owin.2.1.0\lib**net40**\Microsoft.Owin.dll and ..\packages\Microsoft.Owin.2.1.0\lib**net45**\Microsoft.Owin.dll
要覆盖包DLL时我重建被复制和我仍然得到错误:
To overwrite the package DLL being copied when I Rebuild and STILL I get the error:
Could not load type 'Microsoft.Owin.Security.AuthenticationDescription' from assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
再有,如果我复制Microsoft.Owin.dll是相同的版本作为我的本地副本,并覆盖我的本地Microsoft.Owin.dll副本中的垃圾桶,我的ASP.NET MVC重新开始工作,直到我建立再那是当然的。
Again, if I copy the Microsoft.Owin.dll that is the same version as my local copy, and overwrite my local copy of Microsoft.Owin.dll in the bin, my ASP.NET MVC starts working again, until I build again that is of course.
推荐答案
首先检查这两个DLL的大小是一样的吗?如果大小不同,那么DLL是不同的。
First check both dll size is same?If size is different then dll are different.
请按照下列步骤。
- 打开项目
- 删除DLL。
- 现在,生成项目。你会得到错误。
- 关闭项目
- 再次打开项目
- 请不要建项目
- 清洁液
- 添加DLL和参考
- 构建项目
- 您将获得成功
这篇关于奇怪的Microsoft.Owin DLL问题,的NuGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!