Thursday, November 18, 2010

Upgrading to Visual Studio 2010 and SQL Server 2008 Express R2

I made the jump yesterday to finally install and configure my dev machine to run the latest bits. I upgraded from Visual Studio 2008 to Visual Studio 2010. I also upgraded from Sql Server Express 2005 to Sql Server 2008 R2 Express. I must say that I'm very excited to start using all the new stuff. Rather than installing everything side by side, I decided to scrap the old apps and fully commit to the new pieces.

During this process I had no real problems. The only real problem I had was getting SQL Server 2008 R2 Express configured correctly. I've tried various things to get the new database management tools working inside the SQL Server Management Studio 2008 R2 and couldn't quite figure it out (still can't). No matter what I do, I can't create a new 2008 R2 database without using VS2008 Server Explorer. Whenever I right click and 'Create Database', it always creates a SQL CE 3.5 database instance. This version is missing a lot of functionality. For instance, I'm not able to create views and the designer for this is very kludgy IMO. I'm sure it's something simple, but I just can't figure it out yet.

While trying to get it fixed, I completely uninstalled SQL Server Development Edition 2005. This still didn't solve my problem, so now I'm without Analysis Services 2005 and no full blown SQL Engine. It's all good, I've read that they sit side by side nicely even when installing SQL 2005 after SQL 2008.

The good news is that I can create a 2008 R2 database instance from inside my new VS2010 IDE. That's a win in my book and I'm content with this. The process was pretty simple

  • Uninstall SQL Server 2005 Express

  • Uninstall Visual Studio 2008

  • Install SQL Server 2008 Express R2

  • Install Visual Studio 2010 Professional

  • Reinstall Resharper 5.1

  • Test that everything worked...

  • Convert Projects to VS2010

  • Blog about the new goodness

I did have one pretty nasty problem when converting my ASP.NET MVC project to the 4.0 framework. Visual Studio provided a nice little wizard to do this, but when it did this there were some things that didn't work as expected.

The first problem was that it didn't add System.Core to the references. Without this library referenced, all of my Linq queries were brokent (+100 source files)! While this looks like a pretty simple thing to fix, it turned out to be a little tricky. I couldn't just add it as a reference from inside the IDE like I thought. When I tried to do this, I got an error stating:

"A reference to 'System.Core' could not be added. This component is automatically referenced by the build system."

Hmm... The way I was able to fix it was to:

  1. Right click on my Web Project

  2. Unload Project

  3. Edit the .csproj file

  4. Add <Reference Include="System.Core" /> in the appropriate ItemGroup

  5. Save the change

  6. Right click on my Web Project again

  7. Reload project


I also had (and still have) a problem debugging my web project. When I try to run my project, it does not actually start debugging like it should. The project compiles and starts the ASP.NET Development Server, but it doesn't actually load the URL in my default web browser. When I open the system tray icon and click 'Show in browser...' it crashes. I tried all kinds of things to get it to work, but nothing is working. I've installed a few patches and restarted IIS a few times after each one, but nothing. I've tried running aspnet_regiis -i against the new framework. Again, to no avail. As a test, I ran the project and then went to my web browser and typed in the appropriate URL. It works. I set some breakpoints in my code, and they work too. This works well enough for me.

Next steps I think are to convert my entire project to .NET 4.0 Framework so I can take advantage of all the new goodness with C# 4.0. I also plan to upgrade our web solution from ASP.NET MVC 1.0 to ASP.NET MVC 2.0. I'm also anxious to start using GrapeCity ActiveAnalysis 2.0 Silverlight control.

Upgrading to new development environments is so much fun... I'm actually excited to work a full day tomorrow! :)


Kim said...

This must be more of the "hacker" side than the "trail" side!

Anonymous said...

Hi, I've got a really simple question that I'm sorry to bother you with, but you seem like the kind of guy that'd know ...
Which version(s) of VS2010 can connect to SQL2008R2 (full version, not express). I've recently upgraded our server and now I can't make a connection from VS2005 Std Ed. :-(

Thanks for your time.