Lazy Developer

Sponsors

The Lounge

Wicked Cool Jobs

Generic Content

Follow me @_jimmys

Syndication

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]

Comments

DotNetKicks.com wrote Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 08-22-2008 10:49 AM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Dew Drop - August 23, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - August 23, 2008 | Alvin Ashcraft's Morning Dew
on 08-23-2008 10:17 AM

Pingback from  Dew Drop - August 23, 2008 | Alvin Ashcraft's Morning Dew

Reflective Perspective - Chris Alcock » The Morning Brew #165 wrote Reflective Perspective - Chris Alcock &raquo; The Morning Brew #165
on 08-26-2008 2:34 AM

Pingback from  Reflective Perspective - Chris Alcock  &raquo; The Morning Brew #165

Srinivas Yelamanchili wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 08-27-2008 12:57 AM

Hi, the MSBee installed 'MSBuildExtras.Fx1_1.*.targets.' files in the Program Files/MSBuild/MSBee directory, and not the CrossCompile files

Also, i am using Visual Basic 2008 Express Edition and under Build menu, the only options are for Build and Publish, there is no Configuration Manager.

Under Solution properties -> Compile -> Advanced Compile options -> Target Framework only lists 2.0/3.0/3.5 even after the editing the project file to:

<Import Project="$(MSBuildExtensionsPath)\MSBee\MSBuildExtras.Fx1_1.VisualBasic.targets" />

Thanks,

-srinivas

Jimmy wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 08-27-2008 3:59 PM

I'm not using *target files from MSBee in this post. Approach is generally the same bur implementation a bit different and requires CrossCompile files. However no one said that you have to use that method if MSBee suits you well.

As for Visual Studio Express - I trust your words for I've never used that version. Version I'm writing about (from Professional upward) has Configuration Manager.

mike wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 09-19-2008 5:47 AM
I did not find your configuration file "CrossCompile.CSharp.targets" mentioned in step 2 of your guide. Where can I download it?
pfm wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 10-10-2008 1:39 PM
At the bottom of the post, in fairly small font, and partially displaced by an ad: Published Aug 22 2008, 03:03 PM by Jimmy Filed under: Visual Studio, Tips & Tricks, TFS **Attachment: CrossCompile.CSharp.zip**
Jimmy wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 10-21-2008 2:54 PM

pmf - thanks :)

liviner wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-07-2008 5:06 PM

ZIP file download says it's corrupt, and I've tried to get it from multiple machines.  Any problems with the file?

Thanks!

Peter Rietmann wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-12-2008 8:32 AM

Hi , firstly thanks for the great post. I have followed your directions and have .NET 1.1 Project loaded in VS2008 / TFS and it works fine, I can build no problem. I have tried adding to the TFSBuild.proj but I get there some strange errors such as C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3106: Assembly strong name "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System" is badly formed. It may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).

for each of the net 1.1 references.

If  I run this command in command prompt I get the same exceptions

"C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"  "E:\Drop\Sources\Common.sln" /build "Debug|.NET 1.1"

Any ideas what can be wrong ?

Joe wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-14-2008 3:02 PM

Will this work for vb.net applications as well?

Jimmy wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-16-2008 2:07 PM

liviner: You are the first with problems with file. Send me your email so I can email you files.

Peter: Looks like you have to change build type to ".NE 1.1" in TFSBuild.Proj. There is section that describes build configuration. Check that please and let me know if that helps.

Joe: No idea but I can't see why it shouldn't. Try and let me know.

Paul wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-16-2008 11:19 PM

Thanks for a awesom post. I have a 1.1 web app i'm trying to compile in VS2008. Followed all your steps, but trying to open the proj in VS2008 gives me

'CrossCompile.CSharpWeb.targets' missing. I guess i need the attachment. The one attached is CrossCompile.csharp

Cheers

grateful wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 12-02-2008 1:16 PM

thank you!

Michael wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 12-13-2008 11:00 AM

Hi!

I think you don't get an answer by Joe. I tried yesterday evening with VB.NET 1.1. Sadly I have to tell that it doesn't work with your CrossCompile-Files.

Then I took for example the file CrossCompile.CSharp.targets and copied it into the same folder with the name CrossCompile.VisualBasic.targets.

Afer that, I edited the file like this:

<?xml version="1.0" encoding="utf-8"?>

<!--

Use of included script samples are subject to the terms specified at www.microsoft.com/.../cpyright.htm

Written by Jomo Fisher

-->

<Project

DefaultTargets="Build"

xmlns="schemas.microsoft.com/.../2003">

<!--

These two property groups inform VS that there is a Platform called .NET 1.1 Web.

-->

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|.NET 1.1 Web' ">

<DebugSymbols Condition="'$(DebugSymbols)'==''">true</DebugSymbols>

<DebugType Condition="'$(DebugType)'==''">full</DebugType>

<Optimize Condition="'$(Optimize)'==''">false</Optimize>

<OutputPath Condition="'$(OutputPath)'==''">bin\</OutputPath>

<DefineConstants Condition="'$(DefineConstants)'==''">DEBUG;TRACE</DefineConstants>

<DefineConstants>$(DefineConstants);TARGETTING_FX_1_1</DefineConstants>

<ErrorReport></ErrorReport>

<WarningLevel Condition="'$(WarningLevel)'==''">4</WarningLevel>

<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>

<VbcToolPath>$(SystemRoot)\Microsoft.NET\Framework\v1.1.4322</VbcToolPath>

<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>

</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|.NET 1.1 Web' ">

<DebugType Condition="'$(DebugType)'==''">pdbonly</DebugType>

<Optimize Condition="'$(Optimize)'==''">true</Optimize>

<OutputPath Condition="'$(OutputPath)'==''">bin\</OutputPath>

<DefineConstants Condition="'$(DefineConstants)'==''">TRACE</DefineConstants>

<DefineConstants>$(DefineConstants);TARGETTING_FX_1_1</DefineConstants>

<ErrorReport></ErrorReport>

<WarningLevel Condition="'$(WarningLevel)'==''">4</WarningLevel>

<UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>

<VbcToolPath>$(SystemRoot)\Microsoft.NET\Framework\v1.1.4322</VbcToolPath>

<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>

</PropertyGroup>

<!--

Import the standard C# targets

-->

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

<!--

Now that the standard targets have been brought in. Override some properties

and items it created.

-->

<PropertyGroup>

<AvailablePlatforms>$(AvailablePlatforms),.NET 1.1 Web</AvailablePlatforms>

<AssemblySearchPaths Condition=" '$(Platform)' == '.NET 1.1 Web' ">

{CandidateAssemblyFiles};

$(ReferencePath);

{HintPathFromItem};

{TargetFrameworkDirectory};

{AssemblyFolders};

$(OutputPath);

{GAC}

</AssemblySearchPaths>

<TargetFrameworkDirectory Condition=" '$(Platform)' == '.NET 1.1 Web'">

$(SystemRoot)\Microsoft.NET\Framework\v1.1.4322

</TargetFrameworkDirectory>

</PropertyGroup>

<ItemGroup Condition=" '$(Platform)' == '.NET 1.1 Web'">

<TargetFrameworkDirectoryItem Include="$(SystemRoot)\Microsoft.NET\Framework\v1.1.4322">

<InProject>false</InProject>

</TargetFrameworkDirectoryItem>

</ItemGroup>

<!--

Override this target from Microsoft.Common.Targets so that we can supply our own

value for $(TargetFrameworkDirectory). This controls where assembly resolution

logic finds FX assemblies.

-->

<Target

Name="GetFrameworkPaths"

DependsOnTargets="$(GetFrameworkPathsDependsOn)">

<!-- Get the path to the target .NET framework directory. -->

<GetFrameworkPath

Condition=" '$(Platform)' != '.NET 1.1 Web' ">

<Output TaskParameter="Path" PropertyName="TargetFrameworkDirectory"/>

<Output TaskParameter="Path" ItemName="TargetFrameworkDirectoryItem"/>

</GetFrameworkPath>

<!-- Get the path to the target .NET framework SDK directory. -->

<GetFrameworkSDKPath

Condition=" '$(Platform)' != '.NET 1.1 Web' ">

<Output TaskParameter="Path" PropertyName="TargetFrameworkSDKDirectory"/>

<Output TaskParameter="Path" ItemName="TargetFrameworkSDKDirectoryItem"/>

</GetFrameworkSDKPath>

</Target>

<!--

For 1.1 builds, intercept the call to CorResGen target (which generates 2.0 resources) and

slip in a call to our own CoreResGen_1_1.

Handily, the devices version of the ResGen task is able to call the 1.1 version of

ResGen directly.

-->

<UsingTask TaskName="GenerateResource" AssemblyFile="$(MSBuildExtensionsPath)\MSBee\MSBee.dll"/>

<Target Name="CoreResGen" DependsOnTargets="$(CoreResGenDependsOn)">

<GenerateResource

Sources="@(ResxWithNoCulture)"

References="@(ReferencePath)"

OutputResources="@(ManifestResourceWithNoCultureName->'$(IntermediateOutputPath)%(Identity).resources')"

Condition=" '@(ResxWithNoCulture)' != '' ">

<Output TaskParameter="OutputResources" ItemName="ManifestResourceWithNoCulture"/>

<Output TaskParameter="OutputResources" ItemName="FileWrites"/>

</GenerateResource>

<GenerateResource

     Sources="@(ResxWithCulture)"

     References="@(ReferencePath)"

     OutputResources="@(ManifestResourceWithCultureName->'$(IntermediateOutputPath)%(Identity).resources')"

     Condition=" '@(ResxWithCulture)' != '' ">

<Output TaskParameter="OutputResources" ItemName="ManifestResourceWithCulture"/>

<Output TaskParameter="OutputResources" ItemName="FileWrites"/>

</GenerateResource>

</Target>

</Project>

And again. It doesn't work without failure when compiling my project. I take it that, VS 2008 thinks that this is a C#-Project, because the IDE fails by comment lines in VB style (')??

Do you or anyone else have an idea?

Sami wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 12-17-2008 5:52 AM

Hello,

I am having the same problem that liviner has. The .zip file "CrossCompile.CSharp.zip" cannot be extracted as it seems to be corrupt.

Would you be able to email it to me please?

email: sami_islam@hotmail.com

many thanks!

Jimmy wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 01-06-2009 3:34 PM

For all who can't open attached files. Please send me a message with your email address. I will send you required files.

Diego wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 01-22-2009 10:57 AM

Hi Jimmy,

I am having the same problem. The .zip file "CrossCompile.CSharp.zip" cannot be extracted as it seems to be corrupt.

Could you send to me the file by email?

email: ferradiego@gmail.com

many thanks!

Un po' di spazio per Theswra... wrote Gestire un progetto .Net v1.1 in VS2008
on 02-10-2009 8:09 AM

Gestire un progetto .Net v1.1 in VS2008

Ravi Tandra wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 02-27-2009 10:30 AM
Hey Nice Article. I could setup everythin in 1 hour and get going. All credit goes to you. I just have to ignore the generated Designer classes for my xsl files. and re-include the old files. Thanks, Ravi
Jimmy wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 03-04-2009 5:58 AM

All who need files I mention in the post, please go to www.gl-net.org.uk/Downloads.aspx

Tami wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 03-22-2009 3:51 AM

please clarify what do you mean by open your project in 2008? I have a solution (.sln) that has 4 projects in it (csproj).  I updated teh TFSBuild created for this solution to include crosscompile.. but I do not understand what do you mean by project.  Is this my solution? if yes, when I try to open it in VS2008, I get convertion wizard but I am not sure if I want to do that.  Please let me know.

Mike wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 07-23-2009 10:24 AM

Thank you for this great article - it was a major help to us!

I'd also like to post a resolution to a related problem that wound up causing us a lot of grief while using this solution. Hopefully it will help others making use of your article.

Cause and Resolution for build errors like the ones below:

Unrecognized command-line option: '/platform:".NET 1.1"'

Unrecognized command-line option: '/platform:x86'

Unrecognized command-line option: '/platform:AnyCPU'

Cause:

This occurs when you select a different platform from 'Platform target' dropdown on the build tab of the project properties. Switching it back to the original selection does NOT resolve the error.

Resolution:

1) Open the project's .csproj file in notepad and search for (all one word): PlatformTarget

2) You should find one of the following that corresponds to your error:

<PlatformTarget>.NET 1.1</PlatformTarget>

<PlatformTarget>x86</PlatformTarget>

<PlatformTarget>AnyCPU</PlatformTarget>

3) Just delete that line and save and you'll be able to build again.

Hope this helps others and thanks again!

-Mike

Esteban wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 08-03-2009 11:55 AM

Hey, great post.

An item I don't fully understand. I have a web project with a couple of C# class libraries in net 1.1.

I could edit the project files as described in your post with no issues, and they compile good.

But on the Web project file I have a different format with everything inside a <VisualStudioProject> tag and no <Import> tag.

What did I do wrong, or what am I missing?

thanks!

Esteban

Tanya wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 09-23-2009 10:59 AM

Hi everybody, I did all the steps described (I have Windows 2008, IIS7 and VS2008). I can compile my web app,  but when I hit  the url of the web app in the browser I get a runtime error saying "Can not load the type .Global", which usually means that framework version in AppPool in IIS needs to be 2.0. When I switch the AppPool to 2.0 my web app runs (with other issues, but the pages are loading). But the point is to run the web app in .net 1.1. I do not understand what went wrong and what I might be missing.  If anybody have any ideas I would greatly appreciate the help.

-Tanya

Ben wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 10-07-2009 4:04 PM

This works great.  It took me a bit to finally realize what was needed, but other than that, glad I could get it to go.

Because I didn't have any .NET 1.1 projects kicking around, I created a new one in VS 2008, and had to do the following:

1.   .NET 1.1 doesn't like partial classes, so copy the contents of the partial class in the Form1.Designer.cs into the Form1.cs file and delete the Form1.Designer.cs file.  Remember to remove 'partial' from the Form1 class definition.

2.  Remove 'static' from the class Program definition.

3. Delete the Resources.resx and Settings.settings elements from the project.  

4. Remove all references from the project and add the right ones from c:\windows\microsoft.net\framework\v1.1.4322 (System.dll, System.Data.dll, System.Drawing.dll, System.Windows.Forms.dll)

5. Remove 'using System.Collections.Generic' from Form1.cs

6. Remove 'this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;' from Form1.cs

7. Remove 'Application.SetCompatibleTextRenderingDefault(false);' from Form1.cs

This builds a basic Windows Form application with nothing else in it.  When you add buttons, etc. you'll need to remove some non-1.1 elements that the designer puts in for you (like 'UseVisualStyleBackColor').

קייטרינג wrote re: Working with .NET 1.1 in Visual Studio 2008 and Team Server
on 11-26-2009 7:22 AM

Thanks for a awesom post. I have a 1.1 web app i'm trying to compile in VS2008. Followed all your steps, but trying to open the proj in VS2008 gives me

'CrossCompile.CSharpWeb.targets' missing. I guess i need the attachment. The one attached is CrossCompile.csharp

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

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
<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)

CodeBetter.Com