Posts Tagged ‘Visual Studio 2012’

SQL Server Data Tools – September 2013 update

Microsoft has released the September 2013 update for SQL Server Data Tools (SSDT). It contains a fix for the schema compare when working with large display text or high DPI.

Visual Studio 2012 Update 4 RC3

Visual Studio 2012 Update 4 RC3 is out. You can downloaded from

Check out this link for the update description

Install instructions

  • Visual Studio
    • VS2012.4 RC.exe
  • Team Foundation Server (Choose either Web Installer or ISO Image)
    • Web Installer: tfs_server.exe
    • ISO Image: VS2012.4 RC TFS Server ENU.iso
  • Team Foundation Server Express (Choose either Web Installer or ISO Image)
    • Web Installer: tfs_express.exe
    • ISO Image: VS2012.4 RC TFS Express enu.iso
  • Visual C++ Redistributable (Choose architecture: x86, x64, arm)
    • vcredist_x86.exe
    • vcredist_x64.exe
    • vcredist_arm.exe

VS2012: No code coverage colouring

Today I had an issue that I couldn’t get the colouring of code coverage to work even when pressing the “show code coloring” button.

I am using VS2012.2 Ultimate which was upgraded from VS2012.2 Professional.

To fix the problem, I had to reset VS with the following command

devenv /resetuserdata

Issue was reported in the Connect page

IntelliTrace Session’s Slide Deck at DevTeach Mini (HOC)

TFS2012: Create Build Definitions


In this article I will explain how to create a build definition in the Visual Studio 2012 and TFS 2012 server. I used TFS 2012 Express when I wrote this post. In a previous post, I went through the build types that Team Foundation Server supports.

To run a Team Build in TFS, assuming you already setup the Build Controller and Agents, you need to create a build definition. A build definition acts as a settings or configurations file for the build process.

Create Build Definition

The following steps show how to create a team build definition:

Open Visual Studio 2012

Open Team Explorer (View—>Team Explorer)

Connect to a TFS Server and Team Project


After you are connected to the Team Project of interest, go back to the Home menu or page and click on the Builds link


Click New Build Definition to create a new build definition


Give your build definition a meaningful name (e.g. mypp-CI-Debug, myapp-Scheduled-UnitTests).

Queuing process option is sufficiently explained on the screen.


Click on the Trigger node

On this screen, you can specify the build type. Build types were covered in the previous article. Under Rolling builds, Build no more often than ever x minutes means you want at least x minutes between builds to allow for build accumulation. Under Gated Check-in, check the Merge and build up to x submissions, if you want to group submissions when building them to improve performance.


The next step is to configure the Workspace.

On this screen, you can select as many folders as you want. Those folders and their contents will be downloaded (Get performed) to the Source Directory to the code. As a best practice, you want to avoid referencing the root folder of you team project (e.g. $/MyTeamProject) because you want to avoid getting the code for unrelated files or projects. Point to the folder where your code exists and add other folders for other related code or libraries such as libraries for third party controls. When adding multiple folders, make sure you maintain the folder level or relative path among folders at the Build Agent Folder.


Click on the Build defaults, it is probably called with that name because you can override these values when you queue a build <— I am guessing 🙂

On this screen, you have to specify a Build a controller and the drop folder location. The drop folder contains the output of the build process.


The Process screen is where you can define the Build process Template, which is a workflow of activities to execute your team build, and the Build process parameters that are passed to the workflow build template as arguments.


If you are using the Default Template, you need to at least populate the Items to Build parameter with a solution. Deferent build templates may have deferent parameters. You can also create and customize a build template.

Click the ellipsis button

Click on Add

Select a solution

You can select multiple solutions

You can set the configurations for the build in the Configurations tab


In another post, I will explain the other parameters.

The last step, is to define the retention policy. The retention policy automate the deletion of old builds to save disk space.

Save the build definition

Notice that it will be added to the build definition section on the build window. To queue a build manually, right click and click on Queue New Build


VS2012: Run Test Method twice for different connection strings


I am writing this blog post in response to the question posted in the the Social Msdn community. I recorded the steps to solve the problem. Scroll all the way down to view it.

The question was

“We have a project with a number of integration tests testing our Entity Framework 5.0 queries against Sql Server. We have a requirement for this product to also persist to Oracle.

We have the project set up to set the connection string and build and seed the database via EF5 in the AssemblyInitialize.   Changing the connection string is all that is required to successfully run all the tests in the project against either db.

Is there a way to configure the TFS 2012 Build process so that it will execute all tests in this project twice?  Once against Sql Server and then run them all again against Oracle?

If at all possible, we need these tests to run against each database on check-in.”

Proposed Solution

I will be using the data driven unit test approach to solve this issue. The code will read the connection string values form an Excel spreadsheet file.


Create a new Test Project

Add an app.config file


Replace the code in the config file with the following where DBConnections.xlsx is the Excel file name:

<?xml version="1.0" encoding="utf-8" ?>
 <section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
 <add name="ExcelConnection" connectionString="Dsn=Excel Files;dbq=.\DBConnections.xlsx;defaultdir=.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc" />
 <add name="MyExcelDataSource" connectionString="ExcelConnection" dataTableName="Sheet1$" dataAccessMethod="Sequential"/>


Create a new Excel file and save it as DBConnections.xlsx in the project directory

In Sheet1, type ConnectionStrings in the first cell

In cell A2, type the SQL connection string

In cell A3, type the Oracle connection string


Save Excel sheet

Click show all files icon in solution explorer

add DBConnections.xlsx to the project


Change the “Copy to Output directory” of the DBConnections.xlsx to copy if newer. Wasn’t able to get it to deploy to the test Out folder without doing so.

Add a reference to the System.Data.dll

Add TestContext property and decorate your test method with the DataSource and DeploymentItem Attributes

Use TestContext.DataRow[“ConnectionStrings”] to access the row. The test method will run once for each data row

namespace UnitTestProject1
public class UnitTest1
public TestContext TestContext { get; set; }

public void TestMethod1()

Build the solution

From test explorer run the test


Customize Build Template in TFS2012 to Build All Solutions-Part 1


In this article, I will show one way to build all solutions in source control. I will add a new argument to a build template which holds a comma separated string of solutions and I will be using a tool I built in the previous post (can be found here). In the next article, I will reuse the code to build a UIEditor to edit the argument we are passing to the build definition.

Modify the Build Template

In Team Explorer, click on the Source Control Explorer.


Open your build template. Here I am opening a clone of the Default template.


Click on the Arguments tab at the bottom and scroll down. Then click on Create Argument.


Rename the argument to Solutions. The argument will hold comma separated string of solutions.


Collapse the Arguments tab by clicking on it.

One of the new features in Visual Studio 2012 is the ability to search or find text in a Work Flow document. Press ctrl + F and find BuildSettings.ProjectsToBuild.


There are two instances that need to be replaced with Solutions.Split(“,”c), VB code Smile: One in the Clean Configuration sequence and the other in Compile and Test for Configuration sequence. While you are there, change the Display Name the For Each loop if you want to.


Save and Check in.


Modify Build Definition

Go to Builds in Team Explorer.


Edit an existing build or create a new build definition.


Go to the process tab, expand Show Details.

From the drop down select the Build process File you modified.


Launch the tool that finds all solutions in source control (Check this article).

Copy the found solutions.


Paste the copied value into the Solutions argument.


Save and queue a build


In my repository, I have 6 solutions and they all got built 🙂


In part two, I will create a UI Editor to avoid launching the solutions finder tool.