Can't find NuGet.Server.DataServices.Packages

Feb 7, 2012 at 1:11 PM

Following the instructions to host my own NuGet server, I created an blank ASP.NET Web Application project and added the NuGet.Server package to it.  According to the package manager, I have:

  • Id: NuGet.Server
  • Version: 1.6.1

However, when I look at NuGet.Server.dll in my project References, the properties show it is version 1.6.0.0.

Even more confusing, when I run, the failure references NuGet.Server version 1.0.0.0:

System.TypeLoadException was unhandled by user code

  Message=Could not load type 'NuGet.Server.DataServices.Packages' from assembly 'NuGet.Server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  Source=NuGet.Server  TypeName=NuGet.Server.DataServices.Packages
  StackTrace:
       at NuGet.Server.NuGetRoutes.MapRoutes(RouteCollection routes)
       at NuGet.Server.NuGetRoutes.Start() in C:\Workspace\NuGet\NuGet.Server\DataServices\Routes.cs:line 15

As a NuGet newb, this is thoroughly confusing me.  Any pointers?

Developer
Feb 7, 2012 at 5:17 PM

The package version and the assembly version aren't necessarily reved together. The latest NuGet.Server is 1.6.0.0 so you're good there.

Could you print what your msbuild log says msbuild MyServer.csproj /v:N and what version of the NuGet.Server is being loaded into your AppDomain once you run the application (Debug -> Windows -> Show Modules)?

 

Feb 8, 2012 at 3:09 PM

Here's the MSBuild output:

Microsoft (R) Build Engine Version 4.0.30319.1[Microsoft .NET Framework, Version 4.0.30319.239]Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 2/8/2012 10:02:19 AM.Project "C:\Workspace\_Common\_CompanyTools\NuGet\NuGet.Server\NuGet.Server.csproj" on node 1 (default targets).GenerateTargetFrameworkMonikerAttribute:Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.CoreCompile:Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files._CopyFilesMarkedCopyLocal:  Copying file from "C:\Workspace\_Common\_CompanyTools\NuGet\packages\NuGet.Server.1.6.1\lib\net40\NuGet.Server.dll" to "bin\NuGet.Server.dll".CopyFilesToOutputDirectory:  Copying file from "obj\Debug\NuGet.Server.dll" to "bin\NuGet.Server.dll".  NuGet.Server -> C:\Workspace\_Common\_CompanyTools\NuGet\NuGet.Server\bin\NuGet.Server.dllDone Building Project "C:\Workspace\_Common\_CompanyTools\NuGet\NuGet.Server\NuGet.Server.csproj" (default targets).
Build succeeded.    0 Warning(s)    0 Error(s)
Time Elapsed 00:00:00.17

The modules show NuGet.Server as "version 1.0.0.0":

NuGet.Server.DLL C:\...\AppData\Local\Temp\Temporary ASP.NET Files\root\3302f755\28740448\assembly\dl3\e66746c9\bc3305d5_98e5cc01\NuGet.Server.DLL No Yes Symbols loaded. C:\...\AppData\Local\Temp\Temporary ASP.NET Files\root\3302f755\28740448\assembly\dl3\e66746c9\bc3305d5_98e5cc01\NuGet.Server.pdb 20 1.0.0.0 2/7/2012 8:03 AM 00E20000-00E28000 [496] WebDev.WebServer40.EXE: Managed (v4.0.30319)

Developer
Feb 8, 2012 at 3:43 PM

My guess is the assembly name of the project you are building is "NuGet.Server". When you compile your application, it ends up overwriting the binary from the package since the output files are named the same. Just pick a different name for your project or a different output assembly name.

Feb 8, 2012 at 3:50 PM

*smack*

Now it's obvious!  Thank you so much for pointing that out!