In this episode we got a little serious and talk to Nick Pearson, Mike Price and Nishanth Samala about an application they are working on to help friends and loved ones use targeted communications when a medical “situation” make things exceedingly difficult.
Not only did we get serious but we also got very personal as we shared some real experiences of the Smackdown hosts to drive home some of the real benefits of this type of technology.
Play Episode 49
Personal request: Check out the links below. Get in shape and make a difference. Thanks.
Find this episode here: http://developersmackdown.com/Archives/Show/49
Find The Smackdown on your phone:
Today I thought it be cool to create a web site on Azure and use all of the great new capabilities of MVC3 and Razor. So, I fired up Visual Studio 2010 and unfortunately there were no templates that allow you to do such a thing. Well then, knowing that you can “bin deploy” MVC 3 apps on servers that don’t have MVC3 installed on them by including the right binaries I figured I would give it a go anyway. Here’s what I did and this may look like a lot of steps but I was able to do this all in the span of about an hour sitting at Hooters, coding, talking to some friends and having a beer.
- I created 2 solutions in 2 different folders. One to create the Azure setup (I just used the existing MVC2 template to get things started) and a separate one with MVC3 using Razor as the view engine.
- In the Azure solution, I deleted all of the common MVC folders (Content, Controllers, Models, Scripts and Views) to get them out of the way
- In Windows Explorer, I copied those same folders from the MVC3 project over to the Azure project (the MVC2 and MVC3 folder structure is consistent)
- Back in Visual Studio (in the Azure project), I clicked on the “Show All Files” icon so I could see the folders and files
- Right-click on each of the folder names that I had previously deleted then copied and selected “Include in Project”. All of the subordinate files are included automatically.
- Now, to help make sure that the MVC3 assemblies are available for the application, I created a “Binaries” folder in the Azure project. Thanks to Scott Hanselman’s Post and Reflector I found out which assemblies to copy and from where. Copy all of the assemblies on the list to the Binaries folder you just created. Here’s the list:
- System.Web.Mvc.dll (v 126.96.36.199) and System.Web.Helpers.dll are the two assemblies that the application needs direct references to. The rest of the assemblies are dependencies of those two.
Mvc can be found here: Depending on your system (Program Files or Program Files (x86))\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies
The rest can be found here: Depending on your system (Program Files or Program Files (x86))\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies
- Make sure the “Build Action” on the dll files in the “Binaries” folder is set to “None” on all files
- Remove the existing reference to “System.Web.Mvc” since it is pointing to version 2 and we want version 3
- Add references to all the assemblies and set the “Copy Local” property of each to “True”. Worth noting: The application really only needs references to a couple of the assemblies (mainly Mvc and Helpers) so it is arguable that you should only reference those two in the app and the installation process should make the rest of the assemblies available rather than using the VS project do your dirty work. I tend to agree with that and in a production setting I would subscribe, however, for the purposes of this post, and to ease the deployment to Azure, I added all 7 of the references directly in the project and set them all to copy local.
- Modify Web.config (this is easier doing a side-by-side compare with the original MVC3 app and the Azure app config files)
- In “<system.web><compilation …><assemblies>” change the version number of “System.Web.Mvc” to “188.8.131.52
Add “<add assembly="System.Web.Helpers, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />” and “<add assembly="System.Web.WebPages, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> to the list of assemblies. So, ultimately, it will look like this:
Make sure <pages><namespaces> looks something like this:
Finally, for the sake of being thorough, change the assembly binding at the bottom of the config so that all references point to MVC version 3
Your MVC3/Razor app should now be runnable within the local Azure development environment. I’m not going to cover it in this post but if you add a certificate and appropriate credentials, you should be able to publish the app directly to a live Azure site.
In this version, Clark and I muse about ASP.NET Helpers and NuGet. What are they, getting started and of course deploying.
Listen Now: Play Here
The number of helpers is slowing growing. Not only are there some good ones included with the framework but the community has started to embrace things as well. After the show, we decided to just create the IE9 Helper we talked about. It has since been published and you can check it out at: http://csell.net/2011/01/29/IntroducingTheIE9HelperV1.aspx. During the show we mentioned we were not aware of the actions required to have your helper listed in the WebMatrix NuGet feed. As it turns out, you just have to include the tag ‘ASPNETWEBPAGES’. See the complete NuGet list here: http://nuget.org/Tags/ASPNETWEBPAGES
Make sure you hit your local grocer and pick up a 6′er of the newly released Obama beer.
We’re goin to Vegas baby! Clark Sell and I will be there soaking up all the info, doin podcasts and passing out stickers. So, come see us, talk, get a sticker and smack it proudly on your laptop lid!
We’ll be at Mandalay Bay for the MIX10 conference where there will be tons of amazing info about:
Windows Phone 7 Series
Note: They will be giving out free development tools and support for all MIX10 attendees. Time to start building apps!
- Managed .NET environment
- XNA (Multi-Player/User Game and Graphic Development)
BTW, the Smackdown podcasts are hanging in the cloud and served up from Azure!
ASP.NET MVC 2.0 – BTW, the RTM version was just announced and released and you can download here.
Pack your bags and get to Vegas!!!