Visual Studio 2012 provides support for new features, such as code review and feedback through the use of the Work Item tracking system in TFS. (You can read more about it in this article New Code Review feature in Visual Studio 2012).

However, to be able to use these features you must use a process template that supports them. If you try to access these features without upgrading the process template you get errors.

This feature can’t be used until your Team Foundation administrator has enabled it on the team project.

To use My Work to multi-task and manage your changes, you must enable the feature on the server.
Click here to enable the new features

features1
features2

The error in the verification step for configuring the team project happen because an old process template is in use.

If your current process template is MSF for Agile Software Development version 4.x then you need to follow the steps in this article: Update a Team Project Based on an MSF v4.2 Process Template.

To being able to update, you first have to download the latest version of the process template. You can do this from Visual Studio. Go to Team > Team Project Collection Settings > Process Template Manager and download the template.
updatetemplate2

After you have the process template files go ahead and update according to the steps defined in the before mentioned article. However, there is a missing command in the first step of the process. You need to change an additional system field than those mentioned in the article:

If you need to do this for multiple projects then you’ll have to run most of these steps for each project. So here are two batch files with commands you need to run:

  • update the Team Project collection (run only once):

    Note: Make sure you set the correct URL to your collection and replace TemplateDir with the actual path of the process template that you downloaded.

  • Update the Team Project (run once for each project)

    You execute the batch passing the name of the project (in quotes if it contains spaces).

After these commands have executed successfully you can go ahead and use the new features.
updatetemplate3

, , , , , Hits for this post: 23930 .

cpplinq: An introduction

cpplinq is a C++ template library that provides .NET-like query operators for sequences of objects in C++11. cpplinq is an open-source library that works both with VC++ compilers (2010 and 2012) and gcc (4.7.0 is the version used for unit tests). The library supports most of the .NET query operators and is extendable with additional operators that can suite some particular use. If you’re not familiar with .NET query operators, this article, http://msdn.microsoft.com/en-us/library/bb394939.aspx, lists and explain them.

The light-weighted library consists of a series of template classes and helper methods, provided in a single header under the namespace cpplinq.

This is a short introduction to the library. More posts will follow. Let’s see some examples.

The following code retrieves all the prime numbers from an array.

A slightly variation produces a sequence of first N prime numbers and transforms them into strings.

The next sample retrieves all the orders from a customer.

Callinq print_orders_by_cust() with argument 1 would print:

On the other hand, if you want to print the last order from a particular customer, the function above would change to something like this:

Calling print_last_order_for_customer() with argument 1 would print:

Hopefully this provides a quick view over the capabilities of the library. In following posts I will show more examples and discuss some of the query operators. To learn more about the library see the following articles:

, , , , , Hits for this post: 34918 .

Text templates (aka T4) is a great feature in Visual Studio, that proves helpful in many scenarios. I use it for instance in developing Alchemy. However, it has a significant drawback: it does not generate code automatically when you build your solution. To build the files and generate their output you have to manually run either Run Custom Tool command for each .tt file, or Transform All Templates for the entire solution.

Run Custom Tool

Transform All Templates

The good news is that Visual Studio 2010 has added capabilities for building the text templates files automatically at the build time. Basically, what you have to do is two things: first install the Visual Studio Visualization and Modeling SDK. Second, manually add the following to the project file:

And that should do the trick. When you build the project, the .tt files will also be built.

To read more about this topic see:

, , , , Hits for this post: 47487 .

I’ve found myself in situations when I spent lots of time debugging because of some variables declared in a base class were written in tens or maybe hundreds of places in the whole hierarchy, across one or multiple projects even. How could you find the right place where the value of such a variable changes? Well, not easy unless you make some changes to the code. In this article I’m going to show how to create a small wrapper to help you there.

But first, some rules of thumb:

  • Don’t make your variables public. This is pretty basic, but I’ve seen experienced people ignoring it; breaking it is a certain cause for maintenance problems.
  • When you have member variables in a base class that can potentially be assigned in many places across the hierarchy make it private, not protected, and provide Get/Set accessors to read and write it. Moreover, prefer to use this accessors in the base class too, instead of accessing it directly. This way you get only one entry point for reading/writing it, so spotting the places where the value changes will be trivial.

If you decide to go with the second rule that I mentioned I can bet you might be tempted to avoid the last advice and write it directly in the base class. Or if you won’t, one of your teammates will. To enforce that, you can use a wrapper class like the one show below.

This template class has the following characteristics:

  • provides a default constructor and an explicit constructor
  • the assignment operator is made private and not implemented, which means you cannot use an object of this type on the left side of an assignment
  • provides the operator T() which allows to read the value without needing an explicit Get accessor
  • provides a Set accessor for changing the wrapper value; this is the only possible entry point for writing
  • has some comparison operators

If you use this to wrap variables in a base class you don’t make it private, but protected in the base class, otherwise you’ll have to provide get/set accessors for the ExplicitWriteVariable object itself. The lacking of operator= will force you though to use the Set() method explicitly.

Here are some samples for using the class:

The following produces an error:

, , , Hits for this post: 22181 .