October 2009 Blog Posts
Have you ever needed to quickly spawn a web server against a local folder to preview a web application? If not, what would you say you do here?
This is actually quite common for me since I receive a lot of zip files containing web applications which reproduce a bug. After I unzip the repro, I need a way to quickly point a web server at the folder and run the web site.
A while back I wrote about a useful registry hack to do just this. It adds a right click menu to start a web server (Cassini) pointing to any folder. This was based on a shell extension by Robert McLaws.
Well that was soooo 2008. It’s almost 2010 and Visual Studio 2010 Beta 2 is out which means it’s time to update this shell extension to run an ASP.NET 4 web server.
Obviously this is not rocket science as I merely copied my old settings and updated the paths. But if you’re too lazy to look up the new file paths, you can just copy these settings (changes are in bold).
32 bit (x86)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VS2010 WebServer]
@="ASP.NET 4 Web Server Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VS2010 WebServer\command]
@="C:\\Program Files\\Common Files\\microsoft shared\\DevServer
\\10.0\\Webdev.WebServer40.exe /port:8081 /path:\"%1\""
64 bit (x64)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VS2010 WebServer]
@="ASP.NET 4 Web Server Here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VS2010 WebServer\command]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\DevServer
\\10.0\\Webdev.WebServer40.exe /port:8081 /path:\"%1\""
I chose a different port and name for this shell extension so that it lives side-by-side with my other one.
Of course, I wouldn’t even bother trying to copy these settings from this blog post since I conveniently zipped up .reg files you can run.
You probably don’t need me to tell you that Visual Studio 2010 Beta 2 has been released as it’s been blogged to death all over the place. Definitely check out the many blog posts out there if you want more details on what’s included.
This post will focus more on what Visual Studio 2010 means to ASP.NET MVC and vice versa.
Important: If you installed ASP.NET MVC for Visual Studio 2010 Beta 1, make sure to uninstall it (and VS10 Beta 1) before installing Beta 2.
In the box baby!
Well one of the first things you’ll notice is that ASP.NET MVC 2 Preview 2 is included in VS10 Beta 2. When you select the File | New menu option, you’ll be greeted with an ASP.NET MVC 2 project template option under the Web node.

Note that when you create your ASP.NET MVC 2 project with Visual Studio 2010, you can choose whether you wish to target ASP.NET 3.5 or ASP.NET 4.
If you choose to target ASP.NET 4, you’ll be able to take advantage of the new HTML encoding code blocks with ASP.NET MVC which I wrote about earlier.
As an aside, you might find it interesting that the System.Web.Mvc.dll assembly we shipped in VS10 is the exact same binary we shipped out-of-band for VS2008 and .NET 3.5. How then does that assembly implement an interface that is new in ASP.NET 4? That’s a subject for another blog post.
What about ASP.NET MVC 1.0?
Unfortunately, we have no plans to support ASP.NET MVC 1.0 tooling in Visual Studio 2010. When we were going through planning, we realized it would’ve taken a lot of work to update our 1.0 project templates. We felt that time would be better spent focused on ASP.NET MVC 2.
However, that doesn’t mean you can’t develop an ASP.NET MVC 1.0 application with Visual Studio 2010! All it means is you’ll have to do so without the nice ASP.NET MVC specific tooling such as the add controller and add view dialogs. After all, at it’s core, an ASP.NET MVC project is a Web Application Project.
Eilon Lipton, the lead dev for ASP.NET MVC, wrote a blog post a while back describing how to open an ASP.NET MVC project without having ASP.NET MVC installed. All it requires is for you to edit the .csproj file and remove the following GUID from the <ProjectTypeGuids> element.
{603c0e0b-db56-11dc-be95-000d561079b0};
Once you do that, you’ll be able to open, code, and debug your project from VS10.
Upgrading ASP.NET MVC 1.0 to ASP.NET MVC 2
Another option is to upgrade your ASP.NET MVC 1.0 application to ASP.NET MVC 2 and then open the upgraded project with Visual Studio 2010 Beta 2.
Eilon has your back again as he’s written a handy little tool for upgrading existing ASP.NET MVC 1.0 applications to version 2.
After using this tool, your project will still be a Visual Studio 2008 project. But you can then open it with VS10 and it knows how to open and upgrade the project to be a VS10 project.
What about automatic upgrades?
We are investigating implementing a more automatic process for upgrading ASP.NET MVC 1.0 applications to ASP.NET MVC 2 when you try to open the existing project in Visual Studio 2010. We plan to have something in place by the RTM of VS10.
Ideally, when you try to open an ASP.NET MVC 1.0 project, instead of showing an error dialog, VS10 will provide a wizard to upgrade the project which will be somewhat based on the sample Eilon provided. So be sure to supply feedback on his wizard soon!
Despite what your well intentioned elementary school teachers would have liked you to believe, there is such a thing as a stupid question, and you probably get them all the time via email or IM.
You also know that in half the time it takes to type the question, the person pestering you could have typed the query in their favorite search engine and received an answer immediately.
Let me Google that for you addressed this little annoyance by providing a passive aggressive means to tell annoying question askers to bugger off while at the same time teaching them the power of using a search engine to help themselves.
When I first heard about the Microsoft’s new search engine, Bing, I jumped at purchasing the domain name http://letmebingthatforyou.com/ (though I was remiss in not also registering lmbtfy.com as well. If you own that domain, may I buy it off of you?)
Unfortunately, being way too busy caused me to leave the domain name unused gathering dust until I put out a call on Twitter for help. Not long after Maarten Balliauw and Juliën Hanssens answered the call and put together the bulk of this ASP.NET MVC application using jQuery and jQuery UI.
I really like what they did in that the background image for http://letmebingthatforyou.com/ changes daily to match the one on bing.com. I finally found some time to review the code, do a bit of clean-up, fix some minor issues, and test it so I am now ready to deploy it.
Keep in mind that even though I’m employed by Microsoft, this site is a pet project I’m doing on the side in collaboration with Maarten and Juliën and is in not associated with Microsoft nor Bing in any official capacity. We’re just some folks doing this for fun.
Now go try it out and release your inner snarkiness.
A little while ago, Scott Guthrie announced the launch of the Microsoft Ajax CDN. In his post he talked about how ASP.NET 4 will have support for the CDN as well as the list of scripts that are included.
The good news today is due to the hard work of Stephen Walther and the ASP.NET Ajax team, they’ve added a couple of new scripts to the CDN which are near and dear to my heart, the ASP.NET MVC 1.0 scripts. The following code snippet shows how you can start using them today.
<script src="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js"
type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/mvc/MicrosoftMvcAjax.js"
type="text/javascript"></script>
Debug versions are also available on the CDN.
<script src="http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.debug.js"
type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/mvc/MicrosoftMvcAjax.debug.js"
type="text/javascript"></script>
As ScottGu wrote,
The Microsoft AJAX CDN makes it really easy to add the jQuery and ASP.NET AJAX script libraries to your web sites, and have them be automatically served from one of our thousands of geo-located edge-cache servers around the world.
We currently don’t have the ASP.NET MVC 2 scripts available on the CDN, but that’s something we can consider as we get closer and closer to RTM.
If you’re a manufacturing plant, one way to maximize profit is to keep costs as low as possible. One way to do that is to cut corners. Go ahead and dump that toxic waste into the river and pollute the heck out of the air with your smoke stacks. These options are much cheaper than installing smoke scrubbers or trucking waste to proper disposal sites.
Of course, economists have long known that this does not paint the entire picture. Taking these shortcuts incur other costs, it’s just that these costs are not borne by the manufacturing plant. The term externalities describes such spillover costs.
In economics an externality or spillover of an economic transaction is an impact on a party that is not directly involved in the transaction. In such a case, prices do not reflect the full costs or benefits in production or consumption of a product or service.
Thus the full cost of manufacturing includes the hospital bills of those who get sick by drinking the tainted water, the cost of the crops damaged by the acid rain, etc.
Software is the same way. I got to thinking about this after reading Ted’s latest post that Agile is treating the symptoms not the disease where the complexity that Agile introduces is disparaged and Access is held up as one example of a great “simple” way to develop applications.
I agree that Access is great when you’re building a little database to track Billy’s baseball cards. However, the real world doesn’t stay that simple. As the second law of thermodynamics states (paraphrasing here), entropy tends to increase over time, which is something that Ted doesn’t address in his discussion.
I’m all for simplicity in our tools and methodologies as I think we still have a lot of room for improvement in reducing accidental complexity. Unfortunately, the business processes for which we build software are not simple at all and full of inherent complexity. Oh sure, they may start off as a simple Access database, but they never stay that simple. Every business I’ve ever interacted had very complex sets of business processes, some seemingly cargo cultish in origin, which led to major complexity in business processes.
Ted mentions friends of his who’ve made a healthy living using simple tools to build simple line-of-business apps for customers. And I’m sure they did a fine job of it. But I also made a healthy living in the past coming in to clean up the externalities left by such applications.
I remember one rescue operation for a company drowning in the complexity of a “simple” Access application they used to run their business. It was simple until they started adding new business processes they needed to track. It was simple until they started emailing copies around and were unsure which was the “master copy”. Not to mention all the data integrity issues and difficulty in changing the monolithic procedural application code.
I also remember helping a teachers union who started off with a simple attendance tracker style app (to use an example Ted mentions) and just scaled it up to an atrociously complex Access database with stranded data and manual processes where they printed excel spreadsheets to paper, then manually entered it into another application. I have to wonder, why is that little school district in western Pennsylvania engaging in custom software development in the first place? I don’t engage in developing custom school curricula. An even simpler option is to buy some off the shelf software or simply use a Wiki, but I digress.
These were apps that would make The Daily WTF look like paragons of good software development in comparison.
The core problem here is that while it’s fine to push for simpler tools to reduce accidental complexity, at one point or another we are going to have to deal with inherent complexity caused by entropy. Business processes are inherently complex, usually more than they need to be, and this is not a problem that will be solved by any software. Most are not only inherently complex, but chock-full of accidental complexity as well. Your line of business app won’t solve that. It takes systemic change in the organization to make that happen.
Not only that, but business processes get more complex over time as entropy sets in. The applications I mentioned dealt with this entropy and reached a point where the current solution could not scale to meet that new level of complexity (a different sort of scaling up), so they started to drown in it, the original authors of the applications long gone off to create new apps with new externalities.
Fortunately, the externalities of these applications didn’t cause cancer, but rather kept guys like me employed. Of course, it was a negative externality for the company who kept pumping cash to fix these applications.
Ted paraphrases Billy suggesting that Agile requires even more complex tools, story cards, continuous integration servers, etc. This is an unfair characterization and misses the point of Agile. Agile is less about managing the complexity of an application itself and more about managing the complexity of building an application.
A higher principle of agile is YAGNI (You ain’t gonna need it) until you need it. For example, the 1 to 2 guys in a garage probably don’t need a continuous integration server, stand up meetings, etc and any real agilist worth his or her salt would recognize that and not try to force unnecessary procedures on a team that didn’t need it.
However, as the two garage dwellers start to grow the business and need to coordinate with more developers, such tools come in handy. As you grow a team beyond two people, the lines of communication start to grow exponentially, thus creating inherent complexity. Looking at the cost of developing and maintaining an application over time is where you start to get a full picture of the true cost of building an application.
As Robert Glass pointed out in Facts and Fallacies of Software Engineering, research shows that maintenance typically consumes from 40 to 80 percent of software costs, typically making it the dominant life cycle phase of a software project. Thus these so called “simple” solutions need to factor that in, or the customers will continually be left with the clean-up duty while the polluters have long since moved on.
This morning at 3:17 AM, Mia Yokoyama Haack was born weighing in at 7lb 8.5 oz. Now my world domination crew is complete!
Mia is a fast little one as labor started around 11 PM and she was delivered only four hours later!
This time around, we did a water birth at a birthing center which involves the momma sitting in a big tub for the last part of labor and delivery, which made for a much more comfortable experience than last time. I think she’d definitely recommend it.
We were back home by 6:30 AM which just amazes me. Momma and Baby are doing well. I’m still getting over my cold, but I think the adrenaline of the whole experience helped a lot. :)