⚠️ This page has been archived

✅ New page with updated info: ssw.com.au

Home > Archive > StandardsInternal > DeveloperGeneral > Upgrade to VS 2005 and TFS



NOTE : There is a conversion utility and walkthrough for Visual SourceSafe to Team Foundation conversion available at http://msdn2.microsoft.com/en-us/library/ms181247.aspx . However, we have chosen to archive all the VSS history so that TFS is not cluttered with version updates that don't relate to the current state of our products.

Upgrade from VS 2003 to VS 2005:

Pre-upgrade

  1. Compile all projects in Release mode.
  2. Create a folder named "References" in the solution folder, copy all the references dll files (eg: SSW.Framework.WindowsUI.dll, SSW.Registration.dll, etc...) to this folder.
  3. Add all the references dll files to solution as "Solution Items", so they get saved to TFS source control system later.
  4. Remove those Framework projects from the solution.
    Before
    Figure: Before
    After
    Figure: Before

  5. Update all projects references to the dlls.
  6. Make sure all projects still can compile and run correctly.
  7. Check-in everything to SourceSafe, make sure no files are checked-out.

We are doing this because those framework projects are shared and being used by all SSW products, if they get upgraded now, all other SSW products that are still in .NET 1.1 wouldn't be able to use the Framework, thus the SSW Framework and some other components should be the last ones to get upgraded.

Upgrade

  1. Open the .sln in VS 2005.
  2. Upgrade the projects using the Visual Studio Conversion Wizard.

    Visual Studio Conversion Wizard
    Figure: Visual Studio Conversion Wizard
    Conversion Summary
    Figure: Converion Summary

  3. When you get prompted with the Source Control dialog, select "Permanently remove source control binding associate bindings" and click OK.
    Remove the source control association bindings
    Figure: Remove the source control association bindings

    Note: Now this solution isn't under source control anymore, we will add this solution to TFS later.

  4. Fix all the errors and upgrade issues.
    The common one is the InvalidOperationException due to illegal cross-thread calling.
    InvalidOperationException
    Figure: InvalidOperationException

    For additional information, please refer to MSDN article How to: Make Thread-Safe Calls to Windows Forms Controls You are going to a site outside of SSW .

  5. The solution or the startup project probably has a .exe.manifest, this file was used in .NET 1.1 to get the visual style as Application.EnableVisualStyles() in .NET 1.1 was buggy. For a .NET 2.0 Windows application, please delete the .exe.manifest and use Application.EnableVisualStyles() to get the visual style.

    Find the application entry point and add the highlighted code:

    VB:
    Module Startup
        Public Sub Main()
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(False)
    ...
            Application.Run(StartupForm)
        End Sub
    End Module
    
    C#: [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ... Application.Run(new StartupForm); }
    The EnableVisualStyles and SetCompatibleTextRenderingDefault should be added to the top, typically before the Application.Run.

    SetCompatibleTextRendering determines whether the controls should use GDI+ or GDI for text drawing.

    True Uses GDI+/Graphics.DrawString Behaves same as .NET 1.1.
    False Uses GDI/TextRenderer Behaves similar to .NET 1.1, looks nicer, localizes better.

    Notice the difference (The obvious difference is the "VB .NET" on the third line of the description):

    Without Application.SetCompatibleTextRenderingDefault(False)
    Figure: Without Application.SetCompatibleTextRenderingDefault(False)
    With Application.SetCompatibleTextRenderingDefault(False)
    Figure: With Application.SetCompatibleTextRenderingDefault(False)

  6. VS 2005 solution allows you to add solution folder, this is new in VS 2005.

    Add a new solution folder
    Figure: Add a new solution folder

    Now add 2 new solution folders, named References and Setup.
    * Cut all the references .dll files and paste them to the References" solution folder.
    * Move all the files that related to Setup (.wsi, .bld, etc...) to the "Setup" solution folder.

    The folder structure of Solution Items
    Figure: The folder structure of Solution Items

  7. Most of the SSW products have unit-testing using NUnit, and the nunit-gui.exe is included as part of the project for end users to run the unit tests.

    If your existing NUnit are built using .NET 1.1, it won't work with .NET 2.0 projects due to no forward compatibility in .NET 1.1.
    Please download the latest NUnit package that is built using .NET 2.0 from NUnit download page .

    Basically you only need nunit-gui-runner.dll, nunit-gui.exe, nunit.core.dll, nunit.framework.dll, nunit.uikit.dll, and nunit.util.dll.
    Please include these NUnit files to your solution or update the existing NUnit files.

    You should put all the NUnit files under the "References" folder.

    All the NUnit files in the
    Figure: All the NUnit files are in the "bin" folder. (Bad)
    All the NUnit files are in the
    Figure: All the NUnit files are in the "Solution Items\References\NUnit". (Good)

    Add the commands below to your startup project's post-build event.

    if exist "$(TargetDir)NUnit" rd /s /q "$(TargetDir)NUnit"
    xcopy "$(SolutionDir)References\NUnit" "$(TargetDir)NUnit" /s /i /y /r /q

    Skip the next section "Unbind the SourceSafe association bindings" and continue to Team Foundation Server .



For projects that have been upgraded to .NET 2.0 and currently in SourceSafe:

Unbind the SourceSafe association bindings

  1. Open the .sln
  2. Menu: File --> Source Control --> Change Source Control...
    Click "Change Source Control..."
    Figure: Click "Change Source Control..."
  3. Unbind the solution and all projects
    Click "Unbind"
    Figure: Click "Unbind"
    Make sure everything has been unbound
    Figure: Make sure everything has been unbound



Team Foundation Server:

Setup TFS and connect to TFS

  1. Install Team Explorer , the ISO image is located at \\bee\SetupFiles\SetupMS_DotNet\MS Visual Studio 2005 TFS\en_vs_2005_tfs_trial.iso .

    Install Team Explorer (third menu item)
    Figure: Install Team Explorer (third menu item)

  2. Go to VS 2005's Options, change the source control to TFS.

    Source Control settings
    Figure: Source Control settings

  3. Connect to TFS.

    Click "Connect to Team Foundation Server..."
    Figure: Click "Connect to Team Foundation Server..."

    The server name is "tfs.northwind.com". So add "tfs.northwind.com" to the Team Foundation Server list.

    Add "tfs.northwind.com" to the Team Foundation Server list
    Figure: Add "tfs.northwind.com" to the Team Foundation Server list


Note: TFS doesn't have a standalone program like SourceSafe, everything is to be done using Team Explorer.



Create new Team Project and check-in the source code

Creating TFS project over VPN could take long time, it will save you a lot of time if you can log on to a machine in the same LAN to do this step.

  1. Open the Team Explorer.

    Click "Team Explorer"
    Figure: Click "Team Explorer"

  2. To create a new Team Project.

    Click "New Team Project..."
    Figure: Click "New Team Project..."

  3. Enter the team project name.

    Note : The team project name is the project's namespace. (Eg: SSW.SQLAuditor)
    There is no way to rename a TFS project after it's created, so be cautious and make sure you enter it correctly.

    Enter the Team Project name
    Figure: Enter the Team Project name

  4. Select "MSF for Agile Software Developer – v.40".

    Select "MSF for Agile Software Developer – v.40"
    Figure: Select "MSF for Agile Software Developer – v.40"

  5. Leave the title of team project portal the same as project name.

    Leave the title of team project portal the same as project name.
    Figure: Leave the title of team project portal the same as project name

  6. Create an empty source control folder.

    Select "Create an empty source control folder"
    Figure: Select "Create an empty source control folder"

  7. From the step shown on screenshot above, click "Next >" to see the summary or you can just click "Finish".
    The Team Project creation process may take a while...

    Creating new Team Project...
    Figure: Creating new Team Project...

  8. Before you add the solution to TFS source control, please move your solution folder to C:\Data YourName \ProjectsTFS\ CompanyName.ProjectName \trunk.
    Eg: C:\DataRyanTee\ProjectsTFS\SSW.SQLAuditor\trunk.

    Our TFS should have the source folder structure as below:

    • $/CompanyName.ProjectName/trunk – this will be our main development
    • $/CompanyName.ProjectName/branches – this will contain our side branches after each major release (I.e. R10, R11, etc).

    Example:
    Current development

    • $/SSW.CodeAuditor/trunk/SSW.CodeAuditor.sln
    • $/SSW.CodeAuditor/trunk/Business/SSW.CodeAuditor.Business.csproj
    Branch for Release 10
    • $/SSW.CodeAuditor/branches/R10/SSW.CodeAuditor.sln
    • $/SSW.CodeAuditor/branches/R10/Business/SSW.CodeAuditor.Business.csproj

    Dev folder structure should match the TFS source folder structure:

    • C:\DataYourName\ProjectsTFS\CompanyName.ProjectName\trunk
    • C:\DataYourName\ProjectsTFS\CompanyName.ProjectName\branches

    Note: We use the word "trunk" and "branches" because they're the standard people use in Subversion and other source control systems (it's derived from source control 'tree').

  9. Add Solution to Source Control...

    Click "Add Solution to Source Control..."
    Figure: Click "Add Solution to Source Control..."

  10. Select the team project you just created and enter "trunk" as the name for the solution folder.

    Select the team project you just created and enter "trunk" as the name for the solution folder
    Figure: Select the team project you just created and enter "trunk" as the name for the solution folder

  11. After you added the solution to source control, the solution and all projects will have a little yellow plus sign.

    Files that newly added to TFS will have a little yellow plus sign
    Figure: Files that newly added to TFS will have a little yellow plus sign

  12. Check in everything.

    Click "Check In..."
    Figure: Click "Check In..."

  13. Finally, zz the source control folder in SourceSafe.

    zz the folder in VSS
    Figure: zz the folder in VSS



Things you should know when using TFS

  1. When you check out any files from SourceSafe, SourceSafe automatically do a "Get Latest" before checking out the files.
    When you check out any files from TFS, the check out process will not do a "Get Latest" for you, if you have an older version of the files, you need to merge your changes when check in the files to prevent replacing changes made by other developers.
    For more information about this new behavior, read http://www.woodwardweb.com/vsts/000179.html .

  2. Regarding the process of development, we do not branch at end of each release. Instead we branch when there are bugs in previous release that have to be fixed before the next release. This is to minimize branching, since merging between branches is painful.

    Process at end of a release (should be integrated with build script!):
    1. Make a build
    2. Label the trunk source tree with the version number

    Process when critial bugs occur in previous release:
    1. Get the source by label
    2. Branch it into $/Company.Project/branches/vMajor.Minor/
    3. Make your changes in that branch
  3. To see the differences between Team Foundation and Visual SourceSafe, please read MSDN: Introduction to Team Foundation for Visual SourceSafe Users .



Update Wise Installer and Visual Build Script

Coming soon...


Acknowledgements

Ryan Tee