Let us discuss how you can deploy ASP.NET MVC 3 application on server without any support from web hosting providers. .NET framework 4.0 is required to run MVC application. This approach does not require ASP.NET MVC 3 installation on the server.
When we install ASP.NET MVC 3 on a machine, required assemblies are automatically registered in Global Assembly Cache (GAC). GAC is a directory where .NET assemblies can be installed for global sharing. If we use shared hosting we might not be able to deploy these assemblies in GAC.
Following simple steps will help you to deploy MVC application while using shared hosting services:
This is a manual way to deploy ASP.NET MVC 3 with Razor in BIN directory.
When you run application in Visual Studio 2010 with .net framework 4 and MVC 3 installed on your machine the following folders are automatically created:
C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages.
These folders also contain an “Assemblies” folder.
ASP.NET MVC references following additional assemblies:
To deploy your application on shared server with no support from your hosting company you can simply copy these DLL files and paste them to your BIN folder.
Make DLLs local while publishing:
If you don’t want to copy these files manually or don’t have permissions to copy and paste these files you can use this method.
The DLL files mentioned in the manual method can be included in the Bin folder when you publish your project to a production.
To include them to the Bin folder, go to your MVC application project and expand the ‘References’ node in project tree. Select above assemblies then right click and select ‘Properties’ and change ‘Local Copy’ to True as it is False by default. If Local Copy attribute is set to TRUE then selected DLL will be included in ‘Bin’ folder when you publish your project.
Originally posted 2011-06-25 06:06:25.