Undo pending changes on a file in Team Foundation Server

Ralph Jansen BlogIn this small tutorial I will explain how to undo pending changes on a file on your Team Foundation Server. I tested this code on a Team Foundation Server 2010 edition.

First you need the name of the workspace that is locking your file on the server. To accomplish this you can run the following code in the Visual Studio Command Prompt:

tf workspaces /owner:<developers_logonname> /computer:* /server:<your TFS server>

After you have found your workspace name, you can undo the changes for the file with the following code:

tf undo "$/<Path to file to undo>" /workspace:<Workspace name>;<Domain and username> /s:<your TFS server>



  1. Your TFS servername must be with http and the portnumber to succeed.
  2. You can find the path to file simply by clicking the properties on the file in the “Source Control Explorer” window

If you followed the above steps, you will see the following message in the command prompt.

DevExpress Roadmap 2011

Ralph Jansen BlogThe roadmap for DevExpress 2011 is launched. In the roadmap you see that Silverlight will get much more attention. WinForms is and old technology that they probably will let go in future releases. Many users write in the comments that they want to see more attention to WinForms then Silverlight because Silverlight is not “Business Ready”. I think that DevExpress has some more inside news in the Roadmap of Microsoft. I also think that Microsoft wont work on new features for WinForms anymore.

Silverlight is the future and I think that Silverlight will get more attention by Microsoft then WPF (Windows Presentation Foundation) in the future. New news about WPF is not really coming out that often and will not get that much attention as the new features in Silverlight. Silverlight 5 is coming out at the end of 2011. If you think about it, that is a very long time for a release in Silverlight versions. Silverlight 1, 2, 3 and 4 where coming out after about 9 months after each other. Silverlight 4 was released in April of 2010 so the end of 2011 is a lot longer then 9 months! My philosophy is that Microsoft will create Silverlight 5 for Desktop and Windows Phone 7 in one time. They already said that Phone 7 will get a big release at the end of the year and that the new Internet Explorer 9 will be coming this year to Phone 7 including a new version of Silverlight.

So, not so crazy that a company as DevExpress will put that much effort in creating controls for Silverlight and not for WinForms!

If you want to see the roadmap of 2011 for the DevExpress controls, you can find it here.


Default browser VS2010 Add-in

Ralph JansenLast weekend I was working on a MVC 2 application. When I started the application my default browser (Google Chrome) came up. I actually wanted to change my browser for this application to Internet Explorer because the connectivity between IE and Visual Studio 2010 is much better than with Chrome.

The problem is that you can’t choose for the option “Browse With” in a MVC Application. This is because the controller is deciding which view should start. To fix this problem, I found an add-in for VS2010 that you can switch your default browser on the fly from your toolbar. In that way, you can switch easier between your installed browsers. See the screenshot below. image

You can download the add-in by following the link below.


If you get a popup on the startup of your Visual Studio Instance with the text: “The bits have expired, please download an updated version from http://www.wovs.com”, you have to download the new version. To do this, follow the steps on this website: http://blog.wovs.com/2010/10/how-to-update-currently-expired.html
Search in the online extension manager for “Default browser switcher”.

Master-Detail with Silverlight RIA Services

Ralph Jansen

If you want to have a master detail view of you data in Silverlight with RIA Services you have to do two things. One thing is to tell your RIA Services meta data file that you’re including the related entities and you will have to tell your domain service as well that your including the related entities. Follow the tutorial beneath to accomplish an example for creating a master detail relation with Silverlight RIA Services.

Silverlight application

Create a new Silverlight 4 application in VS2010 and enable RIA Services. Also don’t forget to check the box to host your Silverlight application in a website.


Create your Entity Framework 4.0 model so we can generate some RIA Service over it. Just use a simple example so we can practice the master detail relationships. The example that I use is shown below.


RIA Services

After your model is created we have to create the Domain Service that exposes your model from the server to the client. If you haven’t used RIA Services before, I suggested you should read the documentation on the http://www.silverlight.net homepage.

Select add new item on your server website. The same place as you created your Entity Framework model. Now search for the Domain Service template. After you clicked the OK button, you will get a popup that is asking you to specify which entity the domain service should expose from your Entity Framework model. Click the Brands and Product collections, select the checkbox to generate meta data files and to enable client access.

Your Domain Service would look something like this:

Creating the UI

Open your MainPage.xaml file that is generated by creating the Silverlight Application. Open your Data Sources window in VS2010 and drag the Brands and Products grids to your MainPage. You have to drag your Products from the inner collection of Brands.


Now if you run your code. Only the brands will be shown because the UI is connected to the GetBrandsQuery. Now we want to include the products to create a Master Detail relation.

Configure the Meta data

Open your meta data file that is generated by the Domain Service. Find your Brands Entity and in that entity the inner collection property of Products. Add the [Include] attribute above the inner collection of products. In that way we tell RIA Services to include the products for the brand if the products are available.


Make the products available

To make the products available for RIA Services you should include them in the correct query that is used in the client. In our case it is the GetBrands in the Domain Service class.


Add the include statement like below to the query.


Now you are ready to run your code and see a nice example of a master detail relationship in the client.


It is better to create a new query then change the default query. In that way the performance is better because you don’t need the products every time you use the GetBrands query. You can create a query like GetBrandsWithProducts. If you do this, don’t forget to change the query name in the client. This is still referenced to the GetBrands query!!!

ASP .NET MVC 3 Release Candidate released

Ralph JansenOn November 9th 2010 the ASP .NET team released the release candidate of MVC 3. The big change of MVC 3 is the new “Razor” view engine. With this new view engine the syntax of the code is a lot smaller. You now just put an @ on your editor and the intellisense will pick it up.

An other thing that is added in MVC 3 is: partial caching of pages. You can add an attribute above your action in the controller with the right amount of seconds that you want to cache the information. You can even say what the dependent parameter is that the caching will focus on. So if an action is fired and the parametervalue is the same as a previous parametervalue within the specified amount of time, the data will come out of the cache. That way, no database call is required!!!

Check for more information the blog of Scott Guthrie or the official ASP .NET MVC 3 Releas Candidate page.

Change Class template in Visual Studio 2010

Ralph JansenIf you want to change the default ItemTemplate of a class file in Visual Studio 2010, you can follow the steps below.

  1. Go to the right folder on your local machine.
    1. x64: C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEItemTemplatesCSharpCode1033
    2. x86: C:Program FilesMicrosoft Visual Studio 10.0Common7IDEItemTemplatesCSharpCode1033
  2. In that folder you will see the Class.zip file. If you open the class file directly from the zip, you can see the default class template of Visual Studio 2010. In my case, I want to add some default stuff like regions and constructors.
  3. Save the class file. It could be that you get a question that the zip file has changed and want to be reloaded. Click in that case “Yes”.
  4. Now, if you open VS2010, you won’t get the new class template yet. This is because the class template is not yet available in VS2010. VS2010 uses an ItemTemplatesCache directory to store the active templates. You need to override the already active template. This sounds very difficult but is very easy to do. Open your Visual Studio command prompt from the visual studio installation folder in your start menu.
    image(You maybe need to open it as Administrator)
    Fill in this comamnd: “devenv.exe /installvstemplates”
    The strange part here is that you won’t get any confirmation about the success of the installation. This could take a while because when I looked several times in visual studio, I still got the old template. After a few minuts, the new template was suddenly there.

  • It is better to close all your Visual Studio instances. before you follow these steps above.

  • These steps should also work for Visual Studio 2008 but I haven’t tested it.
    Sample template:

    /*using System;
    using System.Collections.Generic;
    $if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
    $endif$using System.Text;

    namespace $rootnamespace$
    public class $safeitemrootname$

    #region Constants


    #region Private Fields


    #region Private Properties


    #region Public Properties


    #region Constructors

    /// <summary>
    /// The default Constructor
    /// </summary>
    public $safeitemrootname$()


    #region Private Methods


    #region Public Methods





  • How to change the setup.exe icon

    Ralph JansenIf you create an application, you have also create an installer project. The installer creates two files for you. An setup.exe file and a msi file. The icons of the two files are set by the default windows icons. In Windows 7 it looks like this: image

    If you want to change the icon of the installer, you can not do that by default in your installer project. Also, the icon of the msi file can not be changed at all. For the setup.exe file you have to do it manually for each time you create a new installer. So every time you fix a bug and releases a new version of your application by the new created installer you have to set the icon manually. Lucky that this is not hard to do.

    Change the icon

    1. Create an installer project with the right settings that you want and build it.
    2. Now open the setup.exe file in the release folder (that is the one that you want to give to your client) in Visual Studio. You can do this as follow:
      1. Click in Visual Studio on File –> Open –> File
      2. Navigate to the exe in the release folder
      3. Click open and then you will see an explorer in Visual Studio
    3. Right click with your mouse on the icon folder and choose “Add Resource…”
    4. The icon type is now selected by default. Choose on the right of the popup for “Import”
    5. Navigate to the right icon that you want and select it
    6. The popup will now close and the icon folder in the explorer is expanded
    7. Make sure that your new icon has the lowest ID. If you don’t do that, the icon will not been shown
    8. Save the setup.exe and return in Windows Explorer to the release folder. You should now see the new icon.

    MS Office Word versus MS Windows Live Writer

    Sorry but this post is only available in dutch.

    Een tijd geleden heb ik een blog geschreven over bloggen door middel van Windows Live Writer. Deze blog werd goed ontvangen. Sander de Graaf wees mij erop dat bloggen naar een SharePoint site ook mogelijk was vanuit ons oude vertrouwde Microsoft Office Word. Aan de hand van die tip ben ik de twee applicaties met elkaar gaan vergelijken.

    Voor het vergelijken heb ik de laatste versies van beide applicaties gebruikt. De Word versie is dus de Bèta 1 van Office 2010.

    Ik heb hieronder een lijst van mogelijkheden neergezet. Indien een plek leeg is bij de beoordeling zal deze optie dus niet beschikbaar zijn in de betreffende applicatie. Een min (-) geeft aan dat ik dingen mis of niet goed vind uitgewerkt dan de andere applicatie. Een plus (+) geeft aan dat het goed is uitgewerkt of beter is dan de andere applicatie. Nogmaals, Ik kijk hier naar het bloggen specifiek voor naar SharePoint toe. Mocht je onderdelen in de lijst missen of vragen hebben over mijn beoordeling, voeg een reactie toe en ik zal deze onderdelen beoordelen.

    Onderdeel Live Writer Office Word 2010
    Tekst schrijven + +
    Tekst opmaak naar sharepoint blog +
    Hyperlink toevoegen + +
    Plaatje invoegen en bewerken + ++
    Fotoalbum invoegen +
    Tabel invoegen +
    Kaart toevoegen +
    Tags toevoegen +
    Video toevoegen +
    Preview van blog ++
    Bron van blog bekijken +
    Blog opslaan op lokale schijf + ++
    Blog publiceren als concept + +
    Werkvenster aanpassen in applicatie (Bv. Procent tekstgrote) ++
    Categorieën toevoegen ++ +
    Publicatiedatum instellen +
    Spelling controleren + ++

    Fijne jaarwisseling!!!

    How To: Bloggen naar sharepoint én…

    Sorry but this post is only available in dutch.

    Zijn jullie het ook zat dat:

    • Alle lettertypes van elke blog anders zijn
    • Alle letter grotes van elke blog anders zijn
    • Je niet makkelijk een plaatje kan zetten in je blog
    • Je niet makkelijk een plaatje tussen de tekst kan zetten

    Gebruik voor dit probleem de Ralphanizer tool. Deze tool heeft voor alle bovenstaande problemen en meer een oplossing. Door sommige mensen wordt deze tool ook wel Microsoft Windows Live Writer genoemd. Met deze tool kan er worden geconnect naar Sharepoint en alle populaire blogs zoals WordPress.

    Download Windows Live Writer van www.msn.nl. Windows Live Writer (verder in dit artikel noem ik dit tool) is een onderdeel van de live producten van Microsoft. Je kan het dus vinden op dezelfde plek als het downloaden van MSN Messenger.

    Installatie wizard
    Bij de eerste keer opstarten zal er een wizard worden opgestart. Volg dan onderstaande stappen.

    1. Selecteer bloggen naar sharepoint
    2. Vul bij de volgende stap de volgende url in: Your sharepoint blog page
    3. Nadat de tool is geconfigureerd zal er om een unieke naam worden gevraagd. Bijvoorbeeld “Advanced Solutions Blog”
    4. Klaar

    Extra instellingen
    Ga voor extra instellingen naar het menu. Klik in het menu op Extra en vervolgens op Accounts. Nu zal er een venster worden geopend waar je rechts de configuratienaam van de wizard terug ziet. Als voorbeeld was “Advanced Solutions Blog” gegeven. Selecteer deze en klik op bewerken.

    Vervolgens zullen de details van deze configuratie worden geopend. Selecteer links in het menu weer op bewerken. Druk vervolgens op de knop “”. Hiermee worden de stijls van Sharepoint binnen gehaald. De blog wordt nu meteen in andere kleuren en lettertypes weergegeven.

    Blog opmaken
    Het opmaken van je blog gaat op deze manier snel en gemakkelijk. Voordat je hem upload kan je zelfs onderaan een preview zien van je blog of de bron code opvragen waardoor je deze blog ook kan kopiëren naar andere toepassingen.

    Het toevoegen van hyperlinks, plaatjes, tags, video’s, kaarten (Bing koppeling), fotoalbums, categorieën van blogs of publicatiedata zijn nog nooit zo makkelijk gemaakt. Zodra je het programma download en opent is alles eigenlijk in één oog opslag duidelijk.

    Happy Blogging!!!