Convert VS2010 to VS2008 C# Project

If you want to convert a C# project in Visual Studio 2010 to one in Visual Studio 2008, then you simply need to open and edit two files in notepad.

First open the solution file and change the following two lines

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

to

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

and then open each project file and change the entry near the top of the file from

ToolsVersion="4.0" to ToolsVersion="3.5"

Convert VS2008 to VS2010 C# Project

If you want to convert a C# project in Visual Studio 2008 to one in Visual Studio 2010 without going through the conversion process by opening it in Visual Studio 2010, then you simply need to open and edit two files in notepad.

First open the solution file and change the following two lines

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008

to

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010

and then open each project file and change the entry near the top of the file from

ToolsVersion="3.5" to ToolsVersion="4.0"

Limiting doubles in C#

I have had a reason to limit the number of decimal places of a double to store in a database. After a quick scout through the web I came across the answer using the Math class. Rather than explain, here is a method showing the use of the Math.Round method.

public double PixelPositionToPercentOfHeight(int top)
{
double percentage = (double)top / (double)(this.ClientRectangle.Height);

// Limit to 6 decimal places
return Math.Round(percentage, 6);
}

Simply Dreaming

Over the last year I have been working in a collaboration to develop a new free html editor. Simply Dreaming can be found at http://sourceforge.net/projects/simplydreaming/.

This is currently being written in C#, although we may port this to QT so that it runs on both Windows and Linux.

C# 3.0 Tutorials

After looking at a previous post on another blog in spanish, I thought I would post a link to the .NET University Course Materials.

70-526 Section 1-2

Manage Control Layout on a Windows Form (Link)

  • Group and arrange controls by using the Panel control, GroupBox control, TabControl control, FlowLayoutPanel control, and TableLayoutPanel control
  • Use the SplitContainer control to create dynamic container areas
  • MSDN Links

  • Panel Control Overview
  • GroupBox Control Overview
  • TabControl Control Overview
  • FlowLayoutPanel Control Overview
  • TableLayoutPanel Control Overview
  • SplitContainer Control Overview
  • I will put up the next section soon.

    Paint .NET

    I am absolutely impressed by this piece of software, fully written in C#, and full source code available.

    pdn310_car_thumb.jpg

    You can download it from http://www.getpaint.net/download.html#Download. My only gripe is that it is not portable.

    Simple Game – Simon

    I originally wrote this port of the eighties game last year in C#, purely to get my head around shaped buttons. I put my code up on codeproject and here you can see the game itself.

    simon_game.jpg

    After sortng out my projects last week, this is one of the first projects I have reuploaded to the web. Download the source code or play the game offline.

    Simon is a simple memory game that you try to remember the order in which the lights appear. The original also had sound, but I have not had time to put that in yet. Maybe version 2 will appear sometime.

    Converting a C# Express 2005 Project to C# Express 2008

    I decided to update all of the projects I have lying around to open in Visual C# Express 2008. I was a bit daunted by opening each project and converting it, so I thought, lets look at what files need changing. when it gets right down to it, only two file types need editing.

    Firstly the solution (*.sln) file needs the following two lines changing from:

    Microsoft Visual Studio Solution File, Format Version 9.00
    # Visual C# Express 2005

    to:

    Microsoft Visual Studio Solution File, Format Version 10.00
    # Visual C# Express 2008

    Then any project file within the solution (*.csproj) needs the following lines changing from:

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == " ">AnyCPU</Platform>
        <ProductVersion>8.0.50727</ProductVersion>

    to:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="3.5" DefaultTargets="Build"
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        <ProductVersion>9.0.21022</ProductVersion>

    Plus you need to add the following two lines to the first PropertyGroup tag

      <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
      <FileAlignment>512</FileAlignment>

    Once this has been done, then the project opens in C# Express 2008 without having to go through the conversion process.

    70-526 Useful Link

    Just a quick link for anyone studying for this exam.

    Study Group 70-526

    Follow

    Get every new post delivered to your Inbox.