Building .NET 1.1 projects with Team Foundation Server
· 2009-11-30 10:14 by Thijs Kroesbergen for Brokenwire.NET
Recently Olav Kwakman and I collaborated for the challenge to build .NET 1.1 code with a TFS 2008 build environment.
In approach #2 of Nagaraju's blog he modifies the output directory by adding an <ItemGroup> in the build script and writes the output to that directory in the After Compile Target Group. The problem with this solution is that the list of file in the ItemGroup is being initialized before the solution is being build. Therefore when your solution output changes the build will not pick this up the first time around. (This is a common "issue" with listing files in itemgroups, many have been tricked into this problem before)
By creating the ItemGroup at runtime (using an CreateItem task) this problem will not occur. Here's how you do just that:
<CreateItem Include ="$(SolutionRoot)\**\bin\$(VS2003_Configuration)\**\*.*"> <Output ItemName ="VS2003_OutputFiles" TaskParameter="Include"/> </CreateItem>
The complete build script will look like this:
<PropertyGroup> <VS2003_Devenv>$(ProgramFiles)\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com</VS2003_Devenv> <VS2003_Configuration>Debug</VS2003_Configuration> </PropertyGroup> <Target Name="AfterCompile"> <Exec Command=""$(VS2003_Devenv)" "$(SolutionRoot)\Your .Net1.1 Solution.sln" /build $(VS2003_Configuration)" /> <CreateItem Include ="$(SolutionRoot)\**\bin\$(VS2003_Configuration)\**\*.*"> <Output ItemName ="VS2003_OutputFiles" TaskParameter="Include"/> </CreateItem> <MakeDir Directories="$(BinariesRoot)\$(VS2003_Configuration)" Condition="!Exists('$(BinariesRoot)\$(VS2003_Configuration)')" /> <Copy SourceFiles="@(VS2003_OutputFiles)" DestinationFiles="@(VS2003_OutputFiles->'$(BinariesRoot)\$(VS2003_Configuration)\%(RecursiveDir)%(Filename)%(Extension)')"/> </Target>
Of course it would be better not to build .NET 1.1 code anymore and just upgrade your projects to a newer version of the .NET framework. From our .NET build jungle Olav and I wish you happy coding...