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
Despite the number of answers I'll add another one which IMHO makes the things a bit clearer.
As Rob and wrightmail already mentioned Microsoft.Web.Infrastructure
is a NuGet package (link not needed, you have it in NuGet Package Manager).
Apparently, it was referenced by your project and suddenly disappeared. A number of reason may exists but the important thing is that despite you may have enabled Automatic Package Restore in Visual Studio by:
certain packages may require a manual reinstall. I am not aware what confuses NuGet, maybe manually removing a reference, but here is the solution I usually apply in such cases. The following PM Console helps restoring a package while preserving the original version (not updating to possibly existing new one):
Update-Package Microsoft.Web.Infrastructure -Reinstall
Version preservation may be required if you do not want to accidentally overwrite an existing package with its newer version which possibly removes "old" functionality you may have used in your project.
And, as a proof, despite a bit lengthy one, that the version does not change, here's the output when the command is executed:
PM> Update-Package Microsoft.Web.Infrastructure -Reinstall
Attempting to gather dependencies information for multiple packages with respect to project 'Samples.NuGet\DemoApp\DemoApp', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for multiple packages
Resolving actions install multiple packages
...
Package removal starts here...
...
Removed package 'Microsoft.AspNet.Web.Optimization 1.1.3' from 'packages.config'
Successfully uninstalled 'Microsoft.AspNet.Web.Optimization 1.1.3' from DemoApp
Removed package 'WebGrease 1.5.2' from 'packages.config'
Executing script file 'D:\Projects\DemoApp\packages\WebGrease.1.5.2\tools\uninstall.ps1'
Successfully uninstalled 'WebGrease 1.5.2' from DemoApp
...
More package removals here. Omitted for brevity...
...
Removed package 'Microsoft.Web.Infrastructure 1.0.0.0' from 'packages.config'
Successfully uninstalled 'Microsoft.Web.Infrastructure 1.0.0.0' from DemoApp
...
More package removals here. Omitted for brevity...
...
Removed package 'Antlr 3.4.1.9004' from 'packages.config'
Successfully uninstalled 'Antlr 3.4.1.9004' from MvcLenseApp
Package 'Antlr.3.4.1.9004' already exists in folder 'D:\Projects\Lense.Mvc5\packages'
--- Install packages (in reverse order) ---
Package 'Antlr.3.4.1.9004' already exists in folder 'D:\Projects\DemoApp\packages'
Added package 'Antlr.3.4.1.9004' to 'packages.config'
Successfully installed 'Antlr 3.4.1.9004' to DemoApp
...
More package installs here. Omitted for brevity...
...
Package 'Microsoft.Web.Infrastructure.1.0.0' already exists in folder 'D:\Projects\Lense.Mvc5\packages'
Added package 'Microsoft.Web.Infrastructure.1.0.0' to 'packages.config'
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0' to MvcLenseApp
...
More package installs here. Omitted for brevity...
...
Package 'WebGrease.1.5.2' already exists in folder 'D:\Projects\DemoApp\packages'
Added package 'WebGrease.1.5.2' to 'packages.config'
Executing script file 'D:\Projects\DemoApp\packages\WebGrease.1.5.2\tools\install.ps1'
Successfully installed 'WebGrease 1.5.2' to DemoApp
Package 'Microsoft.AspNet.Web.Optimization.1.1.3' already exists in folder 'D:\Projects\DemoApp\packages'
Added package 'Microsoft.AspNet.Web.Optimization.1.1.3' to 'packages.config'
...
End of package re-install.
...
Successfully installed 'Microsoft.AspNet.Web.Optimization 1.1.3' to DemoApp
PM>
Of course if you wish to reinstall all packages you may need to get familiar with update/install commands in NuGet here and here.
Try installing Web Platform from https://www.microsoft.com/web/platform/
Hope it helps.
First remove Microsoft.Web.Infrastructure from package.config.
and ran the command again
PM> Install-Package Microsoft.Web.Infrastructure and make sure Copy Local property should be true.
On my machine the Nuget dependency wasn't downloaded correctly, the lib folder inside the nuget package didn't exist, hence the error.
Before
I renamed the Nuget Package in the packages folder and Nuget redownloaded it correctly with the necessary lib folder.
After
In some cases cleaning the project/solution, physically removing bin/
and obj/
and rebuilding would resolve such errors. This could happen when, for example, some packages and references being installed/added and then removed, leaving some artifacts behind.
It happened to me with Microsoft.Web.Infrastructure
: initially, the project didn't require that assembly. After some experiments, the net effect of which was supposed to be zero at the end, I got this exception. Above steps resolved it without the need to install unused dependency.
Install AspNetMVC3ToolsUpdateSetup downloaded from here would solve this problem without adding reference