Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Working with .NET 1.1 in Visual Studio 2008 and Team Server

I was trying to write that post for so long that I've started worry that there will be new version of the Visual Studio before I will even start. Finally, I found some time and here it is.

What I'm going to write about here is how to use the latest IDE to work with a .NET 1.1 applications. Before you will start asking why one would like to do so, there is an answer: because you can. But seriously speaking, I prefer to use much more matured IDE than the very 2003 version. There is also other, even more important reason - TFS. By importing your 1.1 projects into VS2008 you can use full benefits of TFS. That is worthwhile. So let's get started.

For quite a long time I was using MSBee and VS2005 however I was not happy with that and when I advanced to the 2008 version I started looking for something else. Everything started from the great post Jomo Fisher published on his blog "Hack the Build: Targetting .NET Runtime 1.1 Step-by-Step" and later update "Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1" where he described approach that is a way better than using MSBee. Everything was working fine except resources. Jomo uses ResGen task from devices version of the MSBuild but from some reason that seems not working for me. Finally, after some tests I found that adequate tasks from MSBee are working just fine.

Visual Studio 2008

There are simple steps how to do that:

  1. Download and install MSBee.
  2. Download zip file attached to this very post. Put them into your MSBuild folder, typically "C:\Program Files\MSBuild\" or "C:\Program Files (x86)\MSBuild\" if you are living in 64 bit world.
    The first one CrossCompile.CSharp.targets contains all information required to build most of the .NET 1.1 projects except the web and web services which. The latter are covered by the second file.
  3. Import your 1.1 project into Visual Studio 2008.
  4. Unload the project and edit the project file.
  5. In the very first line you will see:

    <Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    Change the value of the ToolsVersion attribute from 3.5 to 2.0 so the line will looks like below. That will tell the MSBuild to use version from .NET 2.0 instead of 3.5.
    <Project DefaultTargets="Build" ToolsVersion="2.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  6. Near the bottom of the project file you will find an Import tag that looks like:

    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

    Replace that with:

    <Import Project="$(MSBuildExtensionsPath)\CrossCompile.CSharp.targets" />

    or with that, if you have a web project:

    <Import Project="$(MSBuildExtensionsPath)\CrossCompile.CSharpWeb.targets" />

  7. Close the file and reload the project. You may have to answer a security dialog where you shall choose "Load project normally" option.
  8. In Visual Studio 2008 go to the Configuration Manager.
  9. Select "New..." from the dropdown under "Active solution platform".
  10. Select ".NET 1.1" or ".NET 1.1 Web" for a web project and click OK.
  11. Build. You can add Generics namespace somewhere and check if there will be an error if you want to ensure that everything is working fine.

That's all. Now you can use the latest VS to work with .NET 1.1 projects. Almost everything works as it should. You can run and debug, add new classes etc. You can also mix .NET 1.1 compatible and newer projects in a single solution, including test projects.

However, there are some limitations you should be aware:

  1. Visual Studio will use .NET 2.0 template to add a new class. That means you will have to remove Generics namespace declaration from the class. One can play with templates and tweak them but I don't see that as a problem.
  2. There is a bit bigger issue for web applications. From the same reason as above, Visual Studio will use aspx page template from the 2.0 framework which uses partial classes to separate your code from generated by the IDE. That means you have to manually tweak every page just after you added it. It's not a big problem however. My colleagues are using that method every day from quite a few months and we are fine.
  3. Similar thing can happen when you drop control from the toolbox to a page.
  4. I haven't done any extensive tests with forms applications and user controls. It builds but I have no idea how IDE will behave. You will have to find that yourself.

Team Foundation Server

There is not too much to write about TFS in that context. Once you create a team project and build you need to remember about two things:

  1. Install MSBee and deploy target files on your build machine.
  2. Remember to enter correct platform when you create new build. You can always edit TFSBuild.proj file later. Either way you should have:

    <ConfigurationToBuild Include="Debug|.NET 1.1">
         <
    FlavorToBuild>Debug</FlavorToBuild>
         <
    PlatformToBuild>.NET 1.1</PlatformToBuild>
    </
    ConfigurationToBuild>

And that is all. HTH.


Posted 08-22-2008 3:03 PM by Jimmy

[Advertisement]

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)