I spent a good part of the last two days trying to get TFS 2012 set up. I thought it would be easier but I hit a few snags during the install. Most of the problems were around SQL Server configuration.

Prior to installing Team Foundation Server, you need to install SQL Server. You can check out the requirements here. In my case, I’m setting up a prototype Virtual Machine instance of TFS that I’ll blow away after I play around for a week. Then I’ll install our “production instance”. So for now, I’m using the SQL Server 2008 Developer R2 edition. I’m pretty sure that Developer is the same as Enterprise in most ways except the licensing.

Prior to install, I downloaded the installation guide which you can find here. Here is a screenshot from part of the documentation that I followed. Unfortunately, this documentation wasn’t specific enough. Note the part I circled that says “SQL Server R2”. Spoiler Alert: That isn’t specific enough!


I installed SQL Server 2008 Developer R2 easily enough. Then I installed TFS 2012. It started off smoothly but when I got to the configuration step TFS complained that I did not have the correct SQL Server! It turns out, what you really need is SQL Server 2008 R2, SP1 (service pack) with a minimum of CU1 (Cumulative Update). Wow, that is SQL Server – 2008 – R2 – SP1 – Cumulative Update 1. Ok, time to hit the internet again and download some patches. I installed SP1 easily enough. But I wasn’t very familiar with the cumulative updates. If I understand correctly, they are patches that come out in between service packs and are tested but not to the degree that a service pack is tested. I can’t say that made me feel all warm and fuzzy, but then again, this is a throw away VM so who cares. The updates are kind of weird, for some reason you can’t just download them. You have to request them from Microsoft. Then they send you an email with the download location. Here is a link to Cumulative update package 1 for SQL Server 2008 R2 Service Pack 1. The odd part is that the CUMULATIVE update is made up of several parts. It doesn’t feel very cumulative to me that way. I had more than one problem with the downloads. Sometimes the zip files would not extract properly. When that happened I got weird errors about needing a second dvd or cd or something! I ignored that and download them again. This time they extracted properly.

I took a guess at the order to install the multipart cumulative update. For some reason, the 3rd part would not install, it told me my SQL Server version was too high! After I installed them, I got the same error from TFS. My SQL Server was not up to the standards expected! I figured it had something to do with the failed update. When downloading the CU, I found out that CU1 was not the latest version. So I requested CU4 from Microsoft. I had similar problems downloading and extracting them. Again this was a multipart install. In this case, 3 of the parts worked but the last one failed! In this case the update simply rolled itself back but I don’t know why. I tried TFS again but it still complained. I went home for the night.

This morning I tried again. I decided to uninstall SQL Server and start again. I did my best to uninstall all of the updates and components of SQL Server but I was worried that I missed something. I went through a similar process. Install SQL Server 2008 R2, install SP1, and this time I started with CU4 instead of CU1. They are supposed to be Cumulative so I hoped it wouldn’t matter. Again I had the same problem installing part of CU4. And again, I got the same error from TFS.

I uninstalled SQL Server AGAIN! Again I installed SQL Server 2008 R2. Again SP1. Again I tried CU1. Again I got the same error installing one part of the update. Again I tried CU4. Again I got the error message during installation of part 4. And again, just for the heck of it, even though I got some errors, I tried to configure TFS 2012. AND IT WORKED! I don’t know why it worked. I didn’t think it would but it did. I swear this is just an example of brute force installation. Trying over and over again until something clicks right.

Now I need to figure out TFS. I am totally new to this product. I’ve been using SVN and GIT for source control, Team City for Continuous Integration, etc. And I’ve used a variety of bug tracking/task reporting products. However, my new employer uses TFS so it’s time for me to learn that too. I’m excited to use TFS for all that it can do. I’ll admit that I don’t love it for source control so far. But the promise of easy integration of all the parts should make it worthwhile.

It seems like for forever I have been dealing with the problem of deploying software and keeping the database updates synchronized at the same time. I’m sure you’ve been there too. If you are developing software, you likely need database schema changes from time to time (or much more often). If you are running a local copy of the database for development (I like working like that), you can easily make the change on your local SQL Server instance (or some other database product). But then you need all of your teammates to update their database instances with the changes. Of course, they may have changes to the schema as well. All that, plus sooner or later you will need to deploy these changes to the test, staging or production database.

Where I have worked we used a variety of techniques to accomplish this goal but it has never been easy. Finally, Microsoft gives us Entity Framework Migrations! This makes this situation very easy to deal with!

Here are some steps to get started with Migrations. I was surprised with how easy this is to use. To be fair, I haven’t pushed this technology much past the basics but it is working quite nicely on my project so far. Also I’m using EF Code First which is really cool but in this post, I won’t be explaining all of the parts of that. I’ll mention the basic steps but if you want to learn more about the many features of EF Code First, you’ll need to look elsewhere.

Beware, I am running Visual Studio 11 Beta, .Net 4.5 Beta, Entity Framework 5 Beta. You should be able to accomplish this stuff with earlier versions too.

Step By Step Guide to Getting Started with Entity Framework Code First Migrations (in C#)

  1. Create a new application. I’m working with a simple C# Console App.
  2. Install Entity Framework. You can do this via the Nuget Package Manager UI or the Package Manager Console. Again, I am using beta so I’ll need to use the console with this command: PM> install-package EntityFramework –includePreRelease
  3. I did get an error when I did that. I don’t recall getting that error in the past but to resolve the error, I used the Add Reference Dialog and added a reference to System.ComponentModel.DataAnnotations. Then I re-tried the console command and it worked just fine.
  4. After installing EntityFramework, my app.config looks like this:
    <?xml version="1.0" encoding="utf-8"?>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,
    EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> </entityFramework> </configuration>

    Thanks NuGet!

  5. Next we’ll need to create an entity that needs to be in our database. In my application, I need a simple object to represent movies.
        public class Movie
            public int Id { get; set; }
            public string Title { get; set; }
            public string Year { get; set; }
            public string Studio { get; set; }

    You will note that I did NOT annotate this class with any attributes at all.

  6. Next we’ll need to create our DbContext. It too is pretty simple.
        public class MovieContext : DbContext
            public DbSet<Movie> Movies { get; set; }
  7. Ok for this simple sample, my initial data schema is done. Since this is Code First however, my database doesn’t actually exist yet. Let’s have Entity Framework create it for us. To do so, we need to run our application. Before running it, just add this code to the Main method of your console app. If your application doesn’t “use” the DbContext, it won’t be generated.
        MovieContext context = new MovieContext();
        foreach(var movie in context.Movies)

    Now just run the app. If you’ve got SqlServer Express installed, you will now have a new database in there that looks like this:image

    Yes, the Id was automatically turned into a primary key. Sweet, huh? Code First Rocks!

  8. Now we have a database and a schema but we haven’t used migrations yet! Let’s get started with that. Back in the NuGet Package Manager Console, type this: PM> enable-Migrations 
  9. When you enable migrations, it will create a Migrations folder in your project with two files.
    • 201204190017084_InitialCreate.cs (your name will vary). This file contains the code to create your database schema from scratch. In this case, there is only one table. This will be important because after we do our next migration, we may need to roll back to our initial design.
    • Configuration.cs which is used for… you guessed it, configuration of Migrations. One important setting is AutomaticMigrationsEnabled. With that set to true, EF will always migrate your database when you run your application and it detects that your context is out of sync with your db.
    • Check out these files and you will see how simple this stuff is. Each migration contains an Up() method and a Down() method. This enables you to migrate your database up and down to any version!
          public partial class InitialCreate : DbMigration
              public override void Up()
                      c => new
                              Id = c.Int(nullable: false, identity: true),
                              Title = c.String(),
                              Year = c.String(),
                              Studio = c.String(),
                      .PrimaryKey(t => t.Id);
              public override void Down()
  10. Now we need to make a change: Add something to the Movie class, something like this: public string Genre { get; set; }
  11. Now if we run our application (remember that we do NOT have Automatic Migrations Enabled). We’ll get an error:image

    In this case, that is perfect and just what we expected.

  12. Back to the Package Manager Console: PM> add-migration Genre That command will create a new Migration file for us with just what we need:
        public partial class Genre : DbMigration
            public override void Up()
                AddColumn("Movies", "Genre", c => c.String());
            public override void Down()
                DropColumn("Movies", "Genre");
  13. Next, this command in Package Manager Console: PM> update-database You’ll get some messages confirming the action. When I check my database I’ll see that the new column was added just as I needed. I can now run my application successfully again. Too bad my application doesn’t do anything.

Eventually, you will have multiple migrations in your project. If you need to revert back to an old version of code, you can also revert back to an old version of the schema by specifying which a target. In this example, I want to target the migration named “InitialCreate”: update-database –TargetMigration InitialCreate

To create scripts instead of actually updating your database, you can use a command similar to this: update-database -Script -TargetMigration Genre These scripts can be saved and used as part of your deployment process.

Those are the basics of Entity Framework Migrations. I think you will find it is pretty easy to use. For more information, I suggest you follow the ADO.Net Team Blog.

Download my sample solution: MigrationsDemo.zip

Sorry for the late notice on this.  I wanted to pass along some information from our friends at the SQL Server User Group:

You must register for this event by noon today (July 9) !


What: July Phila SQL Server Users Group Meeting
Our July meeting will is sponsored by EJBarry, and their President and CEO, Larry Sackett, will give the keynote presentation. His talk will cover MDX and Analysis Services. His partner, Dennis Jefferson, will be the co-presenter. There is no charge for the meeting but you must register at www.pssug.orgno later than Noon, Monday, July 9th. Urban Outfitters’ building is secure and your name must be on the list. *** this is our first meeting down at the old Phila Navy yard, so if you can provide us with feedback on the location and experience, that would be awesome!
When: Wednesday, July 11, 2007 5:30 PM to 8:30 PM
Where: Urban Outfitters
Philadelphia Navy Yard

phillydotnetPerficient sponsored the monthly Philly.Net meeting featuring presentations on SQL Server Integration Services and Sharepoint. 

Don’t miss our next meeting:  July 18th at Microsoft in Malvern.  This meeting is sponsored by Solvepoint.  The speakers and topics haven’t been announced yet, stay tuned for more information.  And keep an eye on this blog for more information about Philly.Net Code Camp 2007.2 scheduled for September.

As always, here is my synopsis of the meeting.  If you miss a meeting or want some information about something you’ve seen at Philly.Net, hopefully you’ll find the answer in my synopsis.  I try to put in links and information that the presenters think are useful.  Click on Philly.Net in the category cloud to see all Philly.Net related content (or click here).


Presenter:  Tony Testa, Perficient

Topic:  SQL Integration Services

Tony started off with a quick intro to SQL Server Integration Services (SSIS), the next generation of SQL Server DTS (Data Transformation Services from SQL Server 2000).  SSIS has many uses but it is well suited for the ETL process.  Improvements over DTS include many new features, logging, configuration, debugging, an API, better deployment, and more.  He quickly jumped into a quick demo showing an SSIS package with a For Each Container using a Script Task – with debugging too!  With these simple demos you can easily see the power of SSIS.  He continued on to demonstrate many other cool features in SSIS.  He wrapped up showing us several different ways to execute a DTS package including from SQL Server, from the File System, and from a .Net application.

Here are the files from Tony’s presentation:  SSIS_Demos.zip (522.14 KB)


Presenter:  Afshin Zavareh, Perficient

Topic:  Sharepoint 2007 Features and Components

Afshin started off good.  I always like a presentation that starts with “I only have one slide”!  The one slide was a good introduction to the various Sharepoint Feature Areas.  He quickly moved on to the demos.  One interesting point he brought up… all of the information for the Sharepoint demo site he created is stored in SQL Server.  There are no actual aspx files.  Sharepoint provides so many cool features that you can easily add into a site.  Here are some of the features Afshin showed us:

  • Using templates to create sites
  • Implement RSS
  • Use built in search – not only for pages but other content like word docs.
  • Create a custom search results page using web parts.
  • Using Site Master Page settings to define the look of the site.
  • Workflow for approvals.
  • Using business forms.
  • and more…

This is a big topic and Afshin did a great job at showing us the basics to many features.  He sent me a nice list of Sharepoint blogs that should be helpful to people who want more information:


Meeting Sponsor: Perficient… Thanks for the Pizza!

Additional Door Prizes courtesy of:  Microsoft and Wrox Publishing.

I’m still in the process of getting my computer all set up since the move to Vista.  Like most developers, I have a lot of software and tools to install.

The other day I installed SQL Server but I had a little trouble getting Reporting Services installed because I didn’t meet the requirements. 

I’ve installed Reporting Services a few times in the past on XP.  So before I even started I installed IIS.  To do so, go to Control Panel > Programs.  From there you can click “Turn Windows features on or off”.  You’ll get a little pop-up with a list of features.  I later learned that just choosing Internet Information Services (and the sub topic World Wide Web Services) is not enough.  I know this because that is all I did and Reporting Services would not install!  Luckily I found this article at support.microsoft.com.  I had to go back and choose some extra features of IIS that did not get installed by default.  The article explains the whole thing, but this picture should make it easy to see which features need to be enabled. 

Yes, it is a small picture but click it so see it full size!

 After making these changes, Reporting Services installed in a snap.  Good luck.