One new feature that comes with Visual Studio 2010 SP1 Beta is support for deployment references. Deployment reference means that you can include all necessary DLL-s to deployment package so your application has all assemblies it needs to run with it in deployment package. In this posting I will show you how to use deployment dependencies.
When I open my ASP.NET web application I have new option for references when I right-click on my web project: Add Deployable Dependencies…
If you select it you will see dialog where you can select dependencies you want to add to your project package.
When packages you need are selected click OK. Visual Studio adds new folder to your project called _bin_DeployableAssemblies.
Screenshot below shows the list of assemblies added for ASP.NET Pages and Razor. All DLL-s required to run ASP.NET MVC 3 with Razor view engine are here. I am not sure if NuGet.Core.dll is required in production but if it is added then let it be there.
Deploy to Azure
I tried to deploy my ASP.NET MVC project that uses Razor to Windows Azure after adding deployable references to my project.
Deployment went fine and web role instance started without any problems. The only DLL reference I made as local was the one for System.Web.Mvc. All Razor stuff came with deployable dependencies.
Visual Studio support for deployable dependencies is great because this way component providers can build definitions for their components so also assemblies that are loaded dynamically at runtime will be in deployment package.