NuGet 服务器无法找到 NuGet.Core DLL
我一直在尝试启动并运行本地版本的 NuGet 服务器。我创建了一个空网站,并通过 VS2010 中的 NuGet 安装了 NuGet 服务器包。当我运行它时,我会看到“主”页面,但是当单击包源时,我会看到以下内容:
服务器在处理请求时遇到错误。例外情况 消息是“无法加载文件或程序集”NuGet.Core, 版本 = 1.4.0.0,文化 = 中性,PublicKeyToken = 31bf3856ad364e35' 或 它的依赖项之一。找到的程序集的清单定义 与装配参考不匹配。 (HRESULT 的异常: 0x80131040)'。有关更多详细信息,请参阅服务器日志。异常堆栈 跟踪是:
在 NuGet.Server.DataServices.Packages.CreateDataSource() 处 System.Data.Services.DataService
1.CreateDataSourceInstance() 位于 System.Data.Services.DataService
1.CreateProvider() 在 System.Data.Services.DataService1.HandleRequest() 位于 System.Data.Services.DataService
1.ProcessRequestForMessage(流 messageBody) 在 SyncInvokeProcessRequestForMessage(Object , Object[] , 对象[] ) 在 System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(对象 实例,Object[] 输入,Object[]&输出)在 System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& 远程过程调用)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
包管理器拉取的 Nuget.Core 版本是 1.4.20615.9012。我在解决方案中的任何地方都看不到任何对 1.4.0.0 的引用。
我尝试添加程序集绑定重定向来处理此问题:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NuGet.Core" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.4.20615.9012"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
但这只会将错误更改为
服务器在处理请求时遇到错误。例外情况 消息是“无法加载文件或程序集”NuGet.Core, 版本=1.4.20615.9012,文化=中立, PublicKeyToken=31bf3856ad364e35' 或其依赖项之一。这 找到的程序集的清单定义与程序集不匹配 参考。 (HRESULT 异常:0x80131040)'。查看服务器日志 更多详细信息。
该DLL肯定在bin文件夹中并且是那个版本。我尝试将引用的“特定版本”属性更改为 False,但这没有任何区别。
有人对我下一步可以尝试什么有什么建议吗?
更新
在挑选项目文件时,我发现了这一点:
<Reference Include="NuGet.Core, Version=1.4.20609.9012, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\NuGet.Core.1.4.20615.9012\lib\net40\NuGet.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
1.4.20609.9012 似乎与任何内容都不匹配,所以我不确定它来自哪里。但是,更新我的绑定似乎有效:
<dependentAssembly>
<assemblyIdentity name="NuGet.Core" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.4.20609.9012"/>
</dependentAssembly>
虽然,说实话,我已经通过运气让它工作了,但我不太确定为什么会修复它。任何想法都会受到欢迎。
I've been trying to get a local version of the NuGet server up and running. I've created an empty website and installed the NuGet server package through NuGet in VS2010. When I run it, I get the 'main' page but when clicking through to the packages feed I get this:
The server encountered an error processing the request. The exception
message is 'Could not load file or assembly 'NuGet.Core,
Version=1.4.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)'. See server logs for more details. The exception stack
trace is:at NuGet.Server.DataServices.Packages.CreateDataSource() at
System.Data.Services.DataService1.CreateDataSourceInstance() at
1.CreateProvider() at
System.Data.Services.DataService
System.Data.Services.DataService1.HandleRequest() at
1.ProcessRequestForMessage(Stream
System.Data.Services.DataService
messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] ,
Object[] ) at
System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
instance, Object[] inputs, Object[]& outputs) at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&
rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)
The version of Nuget.Core that the package manager pulled down is 1.4.20615.9012. I can't see any references to 1.4.0.0 anywhere in the solution.
I tried adding an assembly binding redirect to handle this:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NuGet.Core" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.4.20615.9012"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
but that just changes the error to be
The server encountered an error processing the request. The exception
message is 'Could not load file or assembly 'NuGet.Core,
Version=1.4.20615.9012, 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)'. See server logs for
more details.
The DLL is definitely in the bin folder and is that version. I've tried changing the reference's "Specific Version" property to False but this doesn't make any difference.
Does anyone have any suggestions for what I could try next?
Update
On picking through the project file, I found this:
<Reference Include="NuGet.Core, Version=1.4.20609.9012, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\NuGet.Core.1.4.20615.9012\lib\net40\NuGet.Core.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
The 1.4.20609.9012 doesn't seem to match anything so I'm not sure where that's coming from. But, updating my binding to this seems to work:
<dependentAssembly>
<assemblyIdentity name="NuGet.Core" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.4.0.0" newVersion="1.4.20609.9012"/>
</dependentAssembly>
Although, to be honest, I've got it working through luck and I'm not really sure why this fixes it. Any ideas would be very much welcomed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在应该解决这个问题。如果不是,请在 http://nuget.codeplex.com 上提交错误
This should be fixed now. If it isn't please file a bug on http://nuget.codeplex.com
只是对此有一点了解,因为我之前也遇到过这个问题,并以与您类似的方式修复了它 - 尽管我的问题发生在我有多个 .sln 文件和项目的情况下,并且通过 Nuget 包下载,绑定变得完全错误。它开始引用我不使用且没有的版本,并且所有绑定都被搞乱了。基本上,简单的解决方案是重写您自己的绑定,并检查是否删除(也包括隐藏文件)(如果有)对可能影响您的项目的其他绑定版本的引用。遗憾的是,在我看来,这种情况发生在我的 EF 试图变得太聪明并且编写和引用了错误的绑定的情况下,尽管更新 Nuget 包也没有帮助,但我很高兴您得到了解决方案。如果有人确实遇到这样的问题,只需首先检查您的引用、版本和绑定即可。
just a little insight into this as I came across the problem before as well and fixed it similarly to yourself - although mine occurred where I have multiple .sln files and projects and through the Nuget package downloads the bindings became completely wrong. it started referencing versions I don't use and didn't have and all the bindings were mucked up. basically the simple solution is to re-write your own bindings and check you remove (hidden files too), if you have any, references to the other binding versions anywhere that could affect your project. sadly this occurs in my opinion where my EF was trying to be too clever and writing and referencing the wrong bindings, although updating Nuget packages didnt help either but im glad you got your solution. if anyone does have any problems like this simply start by checking your references, versions and bindings.