Sometimes when we want to deploy ASP.NET MVC 3 web application to our hosting provider, some assemblies are not to be installed in the Global Assembly Cache (GAC) on the server, and then what is the hack to deploy web application without any issue. We just need to include the needed set of assemblies to run asp.net mvc 3 web application properly in the bin folder.
In the previous version you need to install the following assemblies if you did not install .NET 3.5 SP1.
But if your purchased hosting server does not have support of the ASP.NET MVC 3, you are required to deploy the following set of assemblies in the bin folder of your deployed web application on the hosting server.
You can figure out that not every assembly is referenced. It is not required to reference all of the following assemblies when deploying ASP.NET MVC 3 web application. If they are not available in the GAC you need to be placing the required assemblies in the bin folder.
Visual Studio team provides you a way to add only deployable assemblies to right click on the project and select the Add Deployable Assemblies. You can show the dialog in the following example.
When we build as ASP.NET MVC application, we only need to check the first ASP.NET MVC option to assemble the required assemblies in the _bin_deployableAssemblies. In the case of using Razor View Pages we need to check the second option.
When we click “OK” then what would happen?
New folder named _bin_deployableAssemblies is created and the required assemblies are copied into this folder. Web projects have a built in build task that copies any assemblies in this folder into the bin folder when the project is compiled.
Note that this dialog did not add any assembly references to these assemblies. That ensures that the types in these assemblies do not pollute Intellisense, while still being available to your deployed application. If you actually need to use a type in one of these assemblies, you are free to reference them.
So here is the kicker. If you are building a web application, and you need an assembly deployed but do not want it referenced and do not want it checked into the bin directory, you can simply add this folder yourself and put your own assemblies in here.
If you have ever run into a problem where an ASP.NET MVC site you developed locally does not work when you deploy it, this dialog may be just the ticket to fix it.