Scott Hanselman

Cheesy ASP.NET MVC Project Upgrader for Visual Studio 2010 Beta 1

July 11, '09 Comments [8] Posted in ASP.NET MVC
Sponsored By

WARNING: This is obscure and you likely don't care.

As Phil mentioned a little while back, ASP.NET MVC didn't ship with Visual Studio 2010 Beta 1, but will ship with Visual Studio 2010 Beta 2 (and beyond.)

When VS10 Beta 2 comes out, you won’t need to download a separate standalone installer to get ASP.NET MVC (though a standalone installer will be made available for VS2008 users that will run on ASP.NET 3.5 SP1).

If you're using Visual Studio 2010 Beta 1 and want to use ASP.NET MVC, you can go get a drop of MVC for just this purpose, up on CodePlex.

This particular version of MVC is ONLY for use on Visual Studio 2010 Beta and is temporary. As such, it's got a placeholder version of 1.1, rather than 1.0.

If you have existing ASP.NET MVC 1.0 applications under .NET 3.5 lying around that you want to run them on VS 2010 Beta 1, you'll have to make some version number changes in your web.config.

I had a bunch of existing MVC apps lying around so I did this little upgrader application. It's poop, but it Works On My Machine©. Enjoy.

The code is here and is likely a blot on my soul. It will update the version numbers in the main web.config as well as the one in ~\views. It'll also make up to two backups, just in case.

The app is a .NET 4.0 Beta 1 Application and is zipped up here. You just run ASPNETMVCUpgrader "c:\path to your app"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ASPNETMVCUpgrader
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: ASPNETMVCUpgrader c:\\pathtomyprojectdir");
System.Environment.Exit(1);
}

//Remember there's TWO, count 'em, TWO web.configs. Madness!
TidyUpFile(Path.Combine(args[0], "web.config"));
TidyUpFile(Path.Combine(args[0], "Views\\web.config"));
}

private static void TidyUpFile(string filename)
{
string oldMvcType = "System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35";
string newMvcType = "System.Web.Mvc, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35";

string oldRoutingLine = "<add name=\"UrlRoutingModule\" type=\"System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"/>";
string newRoutingLine = "<add name=\"UrlRoutingModule\" type=\"System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"/>";

if (!File.Exists(filename))
{
Console.WriteLine(String.Format("Can't find {0}. You sure it's there?", filename));
System.Environment.Exit(1);
}

//Fix up the references!
string webconfigtext = File.ReadAllText(filename);
string newwebconfigtext = webconfigtext.Replace(oldMvcType, newMvcType);
newwebconfigtext = newwebconfigtext.Replace(oldRoutingLine, newRoutingLine);

//Keep up to two backups
string backupWebConfig = Path.ChangeExtension(filename, ".mvc10backup");
if (File.Exists(backupWebConfig))
{
var twoIsEnough = Path.ChangeExtension(filename, ".mvc10backup2");
File.Delete(twoIsEnough);
File.Copy(backupWebConfig,twoIsEnough);
File.Delete(backupWebConfig);
}
File.Copy(filename, backupWebConfig);

File.WriteAllText(filename, newwebconfigtext);

//Toot!
Console.WriteLine(String.Format("Updated MVC 1.0 references to MVC 1.1 for Dev10 Betas. \n Created a {0} backup. Toot.", filename));
}
}
}

Enjoy.

Extra Credit: If you'd like to show off for no reason, feel free to rewrite this application in as few lines as possible (but still in C#, Ruby people) and post in the comments.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes on 9 - The .NET Micro Framework with Colin Miller

July 10, '09 Comments [3] Posted in Podcast | Programming
Sponsored By

image

I'm was Building 42 yesterday and stopped by the offices of Colin Miller. He runs the .NET Micro Framework, which is a "Tiny CLR" and supporting libraries that run on embedded systems in as little as 32k! (although usually more). There's 1.5 million devices running the .NET Micro Framework.

Check out the Video at Channel 9, it's short, sweet and to the point and Colin covers a lot of ground. It's also the first video that I filmed and posted in 16:9 720p without changing the aspect ratio, so let me know if you like the video quality.

This means that C# developers with little or NO background in electronics can create very sophisticated hardware systems including sensors, servos, whatever! Colin gives me the whole scoop and explains how the whole thing works from Virtual Machine to Firmware to Hardware.

Getting Started with .NET Micro Framework

1. About .NET Micro Framework

2. Get .NET Micro Framework

3. Learn .NET Micro Framework

I'm going to take a look at this and see how it can improve my arcade machine with some touch-screens and maybe a tilt-sensor for pinball. ;)

You don't need hardware to get stared as there's an emulator. I've got a small starter development point, though, and I'll post more as I explore.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 170 - Kanban Boards for Agile Project Management with Zen Author Nate Kohari

July 10, '09 Comments [1] Posted in Agile | Podcast
Sponsored By

imageMy one-hundred-and-seventieth podcast is up. Today Scott chats with Nate Kohari, author of Ninject, about Nate's new Kanban-inspired project "Zen." Are project boards something your agile team should be thinking about?

Links from the Show

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

Do also remember the complete archives are always up and they havePDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is a sponsor for this show!

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes on 9 - What Laptop do Alpha Geeks Use?

July 7, '09 Comments [12] Posted in Channel9 | Podcast
Sponsored By

image I'm up in Redmond visiting for a few days this week and I'm in a super-secret meeting in an undisclosed location (Well, actually it's Studio C in the 3408 conference room, but still, what can you do with that?) and during a break I noticed how everyone had a different laptop. Here's 6 short minutes on who's running what. You might recognize a few familiar faces. I pulled out my Creative Vado HD and proceeded to be silly.

As with most Hanselminutes on 9 videos, this little diddy is entirely free of content.

Enjoy. Downloads for iPod, Zune, and PSP are also available on the site.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

July 7th - Seattle/Redmond/Bellevue Nerd Dinner

July 6, '09 Comments [1] Posted in NerdDinner
Sponsored By

blogging

Are you in King County/Seattle/Redmond/Bellevue and surrounding areas? Are you a huge nerd? Perhaps a geek? No? Maybe a, dork, dweeb or wonk. Maybe you're in town for an SDR (Software Design Review) or just hanging out. Quite possibly you're just a normal person.

Regardless, why not join us for some Mall Food at the Crossroads Bellevue Mall Food Court on July 7th around 6:00pm?

All the details are at http://www.nerddinner.com/717

Also, please Tweet This!

If you want to come and share something with the group, please do! We're language and technology agnostic and always eager to learn about new stuff.

It'd be great if Microsoft Employees came also - everyone loves to put a face to a blog and sometimes Microsoft folks get tunnel vision and don't learn about what's going on in other groups! All are welcome...Please spread the word!

Hope to see you there. If not, I shall eat my Spicy Chicken alone in peace.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.