I tried to upload my web site to a server. It was working fine with my local host, so I uploaded everything in my localhost wwwroot folder to the server and cha
Here was my scenario.
I had a multi project solution containing projects A, B, C .. N.
Project B was a code library that contained a factory for selectlist objects.
The project would run as expected in development, but when publishing to our test environment I was getting the error you were encountering:
Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
What had happened was through nuget package manager, I had accidentally installed "Microsoft ASP.NET MVC" which installed dependencies for:
Low and behold, Microsoft.AspNet.WebPages depends on "Microsoft.Web.Infrastructure".
My solution was uninstalling the three packages mentioned above (MVC, Razor, WebPages) then right click references > add reference > Assemblies > Extensions > System.Web.MVC.