Opening .NET 2.0 Web Application Projects in Visual Studio 2008

So I’ve downloaded & installed Visual Studio 2008. First impressions: nice. It seems faster than 2005, but that may just because I haven’t installed ReSharper yet :). The multi-targeting feature that allows you to specify which version of the .NET framework to compile the project as is awesome. It makes migration so much easier. I’ve now been able to migrate our whole web solution to Visual Studio 2008 but keep the framework version at 2.0. We’ll upgrade to 3.5 later.

Very glad Microsoft decided to keep Web Application Projects built in to 2008, makes it all really simple. Everything ran fine except for one little gotcha with the web project itself. It’s not a big deal, but it was really annoying and the error messages were not overly helpful. It’s basically around Visual Studio trying to create the required virtual directory for the website in IIS. The error I was getting was:

Creation of the virtual directory failed with the error: Could not find the server ‘’ on the local machine. Creating a virtual directory is only supported on the local IIS server

See below for steps to reproduce & how to resolve this:

Continue reading

Visual Studio 2008 released, available on MSDN now

Microsoft has released Visual Studio 2008 with .NET 3.5.  The full version is up on MSDN now, and the express edition can be downloaded here.  I’ve been really looking forward to this, LINQ, Lambda expressions and extension methods, plus built in JavaScript debugging & intellisense.  But one of the best features IMHO is that we’ll be able to step into the .NET framework code while debugging.  That’s going to be awesome.

To download the Visual Studio releases, you need to do it from the ‘Top Subscriber Downloads’ section, it’s not actually available in the normal subscriber downloads section.  Probably to reduce server load.  VS2008 Professional is a 3.81GB download, so make some room.

I can has a dotnetz compyler


So most people know LOLCats now right?  If not, drop over to for a minute & check it out.  Leave your brain at the door.

So then some genius came along and designed a LOLCode specification, that is, a programming language that uses LOLCats language as its syntax.  That specification is now in its 4th revision (yes, you read that right, people have that much free time on their hands).

But wait, there’s more.  The specification has now been implemented in a number of languages & platforms including .NET.

So you can now write your next ground-breaking social networking startup site in LOLCode.NET.  Yes, you can write software in LOLCode & debug it using Visual Studio.  The compiler was written by Arachnid, very smart guy by the way.  I highly recommend reading his series on Damn Cool Algorithms if you’re interested in such things.  The compiler has been rather well received by the .NET community, so much so that Nick Hodge featured it in a presentation he gave at TechEd07. Nice.

Still, I’m almost certain that this is one of the signs of the apocalypse.

Microsoft providing the .NET source code with VS2008

I already posted this on the tumblelog, but I think it bears repeating: With the next release of Visual Studio, the common .NET assemblies will be provided with source code

Today I’m excited to announce that we’ll be providing this with the .NET 3.5 and VS 2008 release later this year.

We’ll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows).  We’ll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ).  The source code will be released under the Microsoft Reference License (MS-RL).

You’ll be able to download the .NET Framework source libraries via a standalone install (allowing you to use any text editor to browse it locally).  We will also provide integrated debugging support of it within VS 2008.

Continue reading

Nullable types & lazy loading FTW

Visual Studio 2005 & .NET 2.0 introduced a bunch of new concepts to .NET development, probably the most well known being Generics. One of the possibly less well know & certainly less well understood was the introduction of nullable types, specifically nullable value types. 

For the uninitiated, I’ve got a very brief intro below.  Here’s a more in-depth article on Nullables.

Value types (int, long, float, double, etc.) are not able to be set to a null value, they’re set to their default value (for numeric value types this is 0).  To make an int nullable, you append the type with a question mark, i.e. int? This means that you can now do this:

   1:  int? x;
   2:  //Some processing
   3:  if (x == null)
   4:  {
   5:      //Do something
   6:  }

Actually the nullable type wrapper gives you a more elegant way of checking for null with the HasValue property. All nullable types have this property & if the object is not null it will be true.  The nullable type specification is actually a bit of syntactic sugar: int? is just a compiler shortcut for the real Nullable type of Nullable<int>.

Right, nifty, but so what? How do we use this? Well a simple use is when you need to pass through an optional value to a SQL Server stored proc. Previously you’d have to write an overloaded version of the method that didn’t have the optional parameter and just create a null sql parameter for the command. With a nullable int, you can just pass the parameter through as null.

Continue reading

ReSharper 3.0 released

JetBrains have released ReSharper 3.0, but I think they may have to re-brand it, as it now has extensive VB.NET support too:

ReSharper is proud to enable Visual Basic .NET development, providing full support and a host of productivity features. Visual Basic developers will be sure to enjoy a truly enhanced Visual Studio experience thanks to ReSharper’s quick navigation and search, all the important code refactorings, full-fledged code assistance, code completion & generation, code templates, and a lot more.

Maybe they can call it ReCLR or ReNetter or something like that…

Silverlight (aka WPF/E) announced

Microsoft has taken the covers off its high-def Flash competitor, Silverlight.  The browser plugin is available for Windows & Mac for IE, Safari & Firefox (but not Opera for some reason).  It’s still only the February WPF/E CTP that is available for download, this is really just a marketing name change and launch (ala Atlas becoming ASP.NET 2.0 AJAX Extensions).

Not being a flash developer or a graphic designer, there really isn’t a whole lot I could intelligently contribute to this discussion, so I’ll just point you to a whole bunch of other smart people.

[via OffBeatMammal]

TeamCity 2.0 released

Hot on the heels of me plugging the beta release, JetBrains have released the 2.0 version of the TeamCity continuous integration & build management server. Originally written as a Java development tool, it works great for .NET projects too, supporting .NET solution builds natively (for 2003 & 2005 solution files, unlike NAnt)

Notable new features:

  • Delayed commit and remote run functionality now works for Eclipse/Subversion and MS Visual Studio 2005/Team Foundation Server.
  • Out-of-the box search for code duplicates in IntelliJ IDEA Java projects.
  • Dependent builds support and Ivy integration
  • New version control systems support: ClearCase UCM and Team Foundation Server (note: I wouldn’t be bragging about supporting ClearCase, but anyway…)
  • Web diff tool with informative highlighting
  • Easy integration of any third-party reporting tools
  • Smarter build agents management

Download today!

JetBrains launch TeamCity blog

JetBrains have created a dedicated blog for TeamCity, their continuous integration and build management tool. I downloaded the 2.0 beta for TeamCity last week and set up an integration build for the Drive web solution.  It’s brilliant, so simple.  It automatically watches the subversion repository and rebuilds on each checkin, showing all the changes in the files with a side-by-side diff screen.  It can auto-run unit tests and report build status to either email, a system tray app or even a Jabber account!

From the looks of the application, once it gets released to production it could handle our whole build cycle from development all the way to deployment, because it can not only build Visual Studio solution files, but also run NAnt scripts or even just a command line app.  The build processing is ingenious too.  Rather than having to do all work on the server, you can install a client app on multiple computers that connect to the server which can be used to do builds, so that multiple builds can be happening at once.  The diffent builds can be done on specific clients depending on platform and other environment variable targets that can be setup in the build, so you could have a Windows 2003 build and a Linux build running off the one server but they will be built by the appropriate client machine at the time specified (either on check-in or scheduled).

TeamCity costs US$199, which will include the 2.0 release.

Always implement the ToString() method

One of the great features of Visual Studio is its debugging interface.  The ability to watch variables change through the code and inspect them on the fly is invaluable.  The on-hover inspection and quickwatch dialogs are great if you’re dealing with lots of variables or long lists that need analysing.  Being able to view the value of a whole list of objects at once is great.  But this only works for simple data type objects (string, int, float, etc.).  More complex objects just show the fully qualified type name.  This can become really frustrating if you’ve got a long list of objects and you’re trying to find a specific one. 

The reason for this difference is that when it’s displaying your variables, the watch dialog does an implicit ToString() call to display the ‘value’ column.  If ToString() hasn’t been implemented, it calls the ToString() method of the base object type, which as mentioned, just returns the fully qualified type.  However if you do implement ToString(), it can be a God-send when you’re debugging.

Here’s a trivial example:

Continue reading