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() at1.CreateProvider() at
System.Data.Services.DataService
System.Data.Services.DataService1.HandleRequest() at1.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.
This should be fixed now. If it isn’t please file a bug on http://nuget.codeplex.com