nuget update adds nuget.core dependency in mvc web app

Topics: General
Mar 20, 2013 at 10:51 PM
Edited Mar 20, 2013 at 10:57 PM
nuget update adds nuget.core dependency in mvc web app

Every time I do a nuget update it breaks my deployment.
Somewhere in my solution or project some sort of dependency is added that I cannot find or understand or get rid of.

Today I updated jQuery. Everything seemed fine running locally.
When I deploy to DEV I get an error in the app start up.
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 3/20/2013 4:56:10 PM 

Process name: w3wp.exe 
Exception information: 
Exception type: InvalidOperationException 
Exception message: The pre-application start initialization method Start on type     System.Web.WebPages.Administration.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'NuGet.Core, Version=1.0.11220.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection1 methods)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods() 
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'NuGet.Core, Version=1.0.11220.104, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes() 
at System.Web.WebPages.ApplicationParts.ResourceAssembly.GetTypes() 
at System.Web.WebPages.ApplicationParts.ApplicationPartRegistry.Register(ApplicationPart applicationPart, Func1 registerPageAction)
at System.Web.WebPages.ApplicationPart.Register(ApplicationPart applicationPart)
at System.Web.WebPages.Administration.SiteAdmin.RegisterAdminModule() 
at System.Web.WebPages.Administration.PreApplicationStartCode.Start() 
Why does NuGet do this to me?
I find it very stressful.
The last time this happened I spent most of my day removing every single solitary NuGet package, and adding them all back again.
What a stressfull total pain.

Any suggestions will be appreciated.
Right now my app is dead in the water!

Sincerely, Joe
Mar 20, 2013 at 10:55 PM
Edited Mar 20, 2013 at 10:56 PM
By the way, here are the injected types defined as a part of the app start up:
string noString = string.Empty;
container.RegisterType(typeof(IPosManContext), typeof(PosManContext), noString, new TransientLifetimeManager());
container.RegisterType(typeof(IcssprodContext), typeof(cssprodContext), noString, new TransientLifetimeManager());
container.RegisterType(typeof(ICacheManager), typeof(CacheManager), noString, new TransientLifetimeManager());
container.RegisterType(typeof(IAdminComponent), typeof(AdminComponent), noString, new TransientLifetimeManager());
container.RegisterType(typeof(IReconcileComponent), typeof(ReconcileComponent), noString, new TransientLifetimeManager());
container.RegisterType(typeof(ICssComponent), typeof(CssComponent), noString, new TransientLifetimeManager());
container.RegisterType(typeof(IEntitlements), typeof(Entitlements), noString, new TransientLifetimeManager());
container.RegisterType(typeof(ILogger), typeof(Logger), noString, new TransientLifetimeManager());
I do not want NuGet involved at run time at all.
Why does my app think that I want NuGet involved at run time?

Joe
Mar 21, 2013 at 7:20 PM
Seriously.

I removed every single NuGet reference from my entire solution, added them back again, ran my build/deploy and got the same error.
The web server is starting up the web app and throwing an unhandled error because it cannot find NuGet.Core./
Has anyone else ever had this problem?
I am ready to uninstall NuGet from Visual Studio and add the references manually.
If I cannot get this to work I can never update any references in my app.
Any help?

Joe
Mar 21, 2013 at 7:52 PM
I found that the System.Web.WebPages.Administration.dll was in my _bin_deployables directory.
I have the project set to show the _bin_deployables and the file did not show in Visual Studio, but it was there and the build picked it up.
Also not sure why an extraneous dll can cause this problem. IIS/ASP.NET have 'features' I may never understand.
Not sure how System.Web.WebPages.Administration.dll got in my _bin_deployables directory. This app has been to production seven times now without this problem.
This problem has happenned before, when building/deploying to DEV, after a NuGet update. Usually weeks go by and I forget how I resolved it.
If I determine a scenario where NuGet / Visual Studio bring the file back again I will post it.

Joe