Building binaries targeting .NET 1.1 and .NET 1.0 in TeamBuild

There are two approaches for building binaries targeting .NET 1.1 and .NET 1.0 in TeamBuild.

Approach# 1

1. Upgrade VS2003/VS2002 project files to VS2005 using VS2005 upgrade wizard.

2. Install the msbuild toolkit from here. This toolkit can build msbuild based projects targeting .NET 1.1 and .NET 1.0. Thanks to Robert MCLaws and Jomo Fisher for building such a great toolkit.

3. Locate the target files installed at %ProgramFiles%\MSBuild\Interscape\MSBuildToolkit

4. Follow the steps mentioned in Jomo’s blog and update each solution file to target .NET 1.1 and .NET 1.0.

5. Choose appropriate configuration (platform as '.NET 1.0' or '.NET 1.1') in team build type.

6. Install this toolkit on build machine.

7. Install .NET1.1 and .NET1.0 redist on build machine if they are already not installed.

8. That’s it, kickoff the build!

You may notice that the build process picked up .NET 1.1/.NET1.0 version of compiler and referenced .NET binaries from buildlog.txt.

(Snippet from my build log file)

Project "d:\builddir2\TestProject\Approach1\Sources\TargetNET1.1\TargetNET11.sln" is building "d:\builddir2\TestProject\Approach1\Sources\TargetNET1.1\TargetNET1.1\TargetNET11.csproj" (default targets):

Target PrepareForBuild:

Creating directory "d:\builddir2\TestProject\Approach1\Binaries\.NET 1.1\Debug\".

Creating directory "obj\.NET 1.1\Debug\".

Target CoreCompile:

D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Csc.exe /noconfig /warn:4 /define:CODE_ANALYSIS;DEBUG;TRACE;NET11 /reference:D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll /reference:D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll /reference:D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Xml.dll /debug+ /debug:full /optimize- /out:"obj\.NET 1.1\Debug\TargetNET1.1.exe" /target:exe Program.cs Properties\AssemblyInfo.cs

Another beauty is that you can choose to run code analysis also while building these versions. All you need to do is to enable code analysis for this build type J

(Snippet from my build log file)

Target RunCodeAnalysis:

Running Code Analysis...

D:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe /o:"d:\builddir2\TestProject\Approach1\Binaries\.NET 1.1\Debug\TargetNET1.1.exe.CodeAnalysisLog.xml" /f:"d:\builddir2\TestProject\Approach1\Binaries\.NET 1.1\Debug\TargetNET1.1.exe" /d:"D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" /r:D:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules

Approach# 2

In case you don’t have an option of upgrading the project files to VS2005, you will need to use devenv command line (devenv.com) of the particular version and build. This works well but one difficulty is: TeamBuild needs the project output redirected to one common output folder in order to upload to the release server later on, but you cannot override the output directory with devenv command line. So, you will need either to modify your project files to use one common output directory, or, you will need to know the output directories of individual projects and use them in TeamBuild script to copy separately.

In the below example, I’ve VS2003Application.sln that contains three projects i) VS2003Application.csproj ii) CSWindowsApp.csproj iii) VBApp.vbproj.

I’ve added the following simple script overriding AfterCompile target in my TfsBuild.proj.

<PropertyGroup>

<VS2003_Devenv>$(ProgramFiles)\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com</VS2003_Devenv>

<VS2003_SolutionName>$(SolutionRoot)\vs2003\VS2003Application\VS2003Application.sln</VS2003_SolutionName>

<VS2003_Configuration>Debug</VS2003_Configuration>

</PropertyGroup>

<ItemGroup>

<VS2003_OutputFiles Include="$(SolutionRoot)\vs2003\VS2003Application\bin\$(VS2003_Configuration)\**\*.*"/>

<VS2003_OutputFiles Include="$(SolutionRoot)\vs2003\CSWindowsApp\bin\$(VS2003_Configuration)\**\*.*"/>

<VS2003_OutputFiles Include="$(SolutionRoot)\vs2003\VBApp\bin\**\*.*"/>

</ItemGroup>

<Target Name="AfterCompile">

<Exec Command="&quot;$(VS2003_Devenv)&quot; &quot;$(VS2003_SolutionName)&quot; /build $(VS2003_Configuration)"/>

<MakeDir

Directories="$(BinariesRoot)\$(VS2003_Configuration)"

Condition="!Exists('$(BinariesRoot)\$(VS2003_Configuration)')" />

<Copy

SourceFiles="@(VS2003_OutputFiles)"

DestinationFiles="@(VS2003_OutputFiles->'$(BinariesRoot)\$(VS2003_Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"

/>

</Target>

Couple of things to notice here:

  1. This assumes VS 2003 is installed on the build machine.

  2. I’m using devenv.com, not devenv.exe.

You can extend this to build any number of solutions and different configurations. And, this can be easily modified to target VS 2002. Hope, this will provide you a starting point. Let me know if you need any further help.

Namaste!

Comments

  • Anonymous
    February 08, 2006
    The following is my official VSTS jumpstart kit.&amp;nbsp; I will maintain this post entry going forward....

  • Anonymous
    February 08, 2006
    Internet Links
    Visual Studio Team System Home
    Getting Started with Team Foundation
    MSDN Technical...

  • Anonymous
    February 22, 2006
    Administration
    What is the procedure to backup/restore Team Foundation Server?
    See Buck Hodges’ MSDN...

  • Anonymous
    October 25, 2006
    The following are some different resources to either convert your Visual Studio 2002/2003 projects to

  • Anonymous
    January 23, 2007
    PingBack from http://www.vsts.or.kr/blog/?p=9

  • Anonymous
    February 03, 2007
    I have been working with TFS for quite a long time now and has come across a lot of situations where...

  • Anonymous
    February 08, 2007
    Configuration and Management of Team Foundation Server http://msdn.microsoft.com/vstudio/teamsystem/team/quickstarts/configure/default.aspx

  • Anonymous
    March 27, 2007
    I recently had to customize a Team Build script to build only one VS2003 solution and found that Nagaraju...

  • Anonymous
    March 30, 2007
    一個常問的問題是, 什麼是 MSBuild ? , 什麼是 TeamBuild ? 簡單來說, MSBuild 才是微軟在 建構管理中的核心技術引擎, Team Build 則是 Team Foundation

  • Anonymous
    April 04, 2007
    MSBuild Extras – Toolkit for .NET 1.1 “MSBee” is an addition to MSBuild that allows developers to build

  • Anonymous
    December 10, 2007
    Building non-MSBuild projects is possible. For example you have to build VS2003, Installer, C++, Delphi