Welcome to MSDN Blogs Sign in | Join | Help

Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Jomo Fisher – A while back, I posted a sample that showed how to target the .NET 1.1 runtime (the version that came with Visual Studio .NET 2003 also known as Everett) with MSBuild. Now Beta 2 has rolled around and I can see that there have been enough changes to MSBuild to warrant an entire rewrite of that original sample.

I’ll get into the details of how it all works down below, but right now let’s just get it working on your machine. Here are the steps:

(1)   Copy this MSBuild targets file to “C:\program files\msbuild\CrossCompile.CSharp.targets

(2)   Create a new C# project somewhere called MyApp.

(3)   Use notepad to edit MyApp.csproj. Replace the entire <Import> tag with

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

(4)   When prompted, reload the project. You’ll have to answer a security dialog.

(5)   In VS, click the drop-down that says ‘Any CPU’ and select ‘Configuration Manager’

(6)   Under Active Solution Platform, select <New…>

(7)   Select ‘.NET 1.1’ (pretty cool, eh?) and press OK.

(8)   Build and notice error about System.Collections.Generic. This means its working because generics aren’t supported in 1.1.

(9)   Open Program.cs and delete the line:

using System.Collections.Generic;

     And rebuild.

That’s it, its working.

As with the last sample I posted on this, I expect that only basic scenarios will work here. If you run into a problem, drop me a note. If I see a quick solution I'll post it. Otherwise, I can still publish those limitations here so that other people can learn from your experience.

What’s New?

There are some differences between this version and the prior sample I published that show off some nice new features in MSBuild for Beta2:

  • This version shows how to add entirely new Platforms for VS to pick up. See the $(AvailablePlatforms) property in CrossCompile.CSharp.Targets. You could, pretty easily, add other targets from .NET 1.0 or any other tool that is roughly command-line interchangeable with CSC.EXE.
  • The reference resolution logic in this version is far more robust. Many more scenarios should work now, including references to third-party assemblies as well as project-to-project references. (Though you still can't reference 2.0-compiled assemblies into 1.1 projects--this is a limitation built into the CLR itself).
  • We’ve added a new built in property called $(MSBuildExtensionsPath) which is defined to be like “C:\Program Files\MSBuild”. This is a well-known spot where people can dump their custom targets files. This saves you from having to hard-code a path in your project or template.
  • Targets can now be entirely overridden. The GetFrameworkPaths targets from Microsoft.Common.Targets is overridden in CrossCompile.CSharp.Targets so that an alternate directory for target framework directory can be injected.
  • This version doesn’t build 2.0 and 1.1 at the same time. This is nicer, I think, because otherwise you see duplicate errors when you build.

Moving On

At the end of this month I'm moving from the MSBuild team (5th floor, building 41 in Redmond) to the C# team (1st floor, building 41 in Redmond). Working on MSBuild has been a blast and I intend to keep on blogging about it if I think I having something of value to say. After a while, I hope to have something useful to say about C# too. I think "Hack the Build" still fits, so I'll keep the name.

This posting is provided "AS IS" with no warranties, and confers no rights.

Published Friday, April 22, 2005 2:45 PM by Jomo Fisher
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Blog link of the week 16

Blog link of the week 16
Sunday, April 24, 2005 4:58 PM by Daniel Moth

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

I think there's a bug in the targets file. I think this line (in the PropertyGroup)

<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>

Should read like this:

<TargetFrameworkVersion>v1.1</TargetFrameworkVersion>

I'm not 100% sure. You'd know better than I do.
Sunday, April 24, 2005 5:40 PM by Robert McLaws

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Good eye for spotting that TargetFrameworkVersion issue. However (and unfortunately) the code will only work the way it is now. This property is only used to remove references to warnings that only exist for CSC 2.0. See mention of this property in Microsoft.CSharp.targets.
We hope to fix this issue in Microsoft.CSharp.targets before we ship.

This posting is provided "AS IS" with no warranties, and confers no rights.
Monday, April 25, 2005 12:13 PM by Jomo Fisher

# Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Jomo Fisher has posted an update of his build targets for VS2005 beta 2, with these, you can build apps...
Sunday, May 01, 2005 8:25 PM by DanBartels.CS

# Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Monday, May 02, 2005 2:39 AM by greg hughes - dot - net

# Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Monday, May 02, 2005 2:39 AM by greg hughes - dot - net

# Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Since the release of&amp;nbsp;beta2 of Visual Studio 2005 I have been looking for a way to code in beta2...
Wednesday, May 04, 2005 3:09 PM by TM

# Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Since the release of&amp;nbsp;beta2 of Visual Studio 2005 I have been looking for a way to code in beta2...
Monday, May 30, 2005 7:26 PM by TM

# Announcing the MSBuild Toolkit for Visual Studio 2005 RC!

Friday, June 03, 2005 11:55 PM by Robert McLaws: FunWithCoding.NET

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Thanks for the info! Sorry to see you leave the MSBuild team
Tuesday, June 07, 2005 6:46 PM by Richard Murillo

# Sweet stuff for MSBuild

Monday, June 20, 2005 2:47 PM by marklio

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Very cool. Perhaps it will be possible to add Mono and IKVM targets as well!
Wednesday, June 22, 2005 9:16 AM by casey

# Express support?

I've tried using this in Express Beta 2, but am getting an error.

When I do a build, I get the following 1 warning and 1 error:

Warning 1 The "CFResGen" task could not be loaded from the assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\\Microsoft.CompactFramework.Build.Tasks.dll. Could not load file or assembly 'file:///C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\Microsoft.CompactFramework.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available. C:\Program Files\MSBuild\CrossCompile.CSharp.targets 0 0
Error 2 The "CFResGen" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\" directory. C:\Program Files\MSBuild\CrossCompile.CSharp.targets 113 3
Monday, July 04, 2005 6:33 PM by Ryan Schneider

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Replacing occurances of "CFResGen" with just plain "ResGen" seems to do the trick for me. I assume "CF" refers to the compact framework, which isn't part of Express, correct?

Thursday, July 14, 2005 12:29 AM by Ryan Schneider

# Build .NET 1.1 Assemblies with Visual Studio .NET 2005 (Whidbey) and MSBUILD

Is it possible? Yes, it is possible, though not without a little finesse.
&amp;nbsp;
Jomo Fisher has a...
Thursday, July 21, 2005 12:39 AM by Richard Murillo - VB.NET Code Warrior

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

OK, this is pretty cool.. so now for another challenge: supporting the same mechanism for ASP.NET 1.1 websites.. and not have VS.NET mess up the code when converting to a VS 2005 project....
Thursday, November 10, 2005 5:21 PM by Raimond Brookman

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

The line:
<UsingTask TaskName="CFResGen" AssemblyFile="$(MSBuildBinPath)\Microsoft.CompactFramework.Build.Tasks.dll" />

Implies a requirement for the CompactFramework. Installing the 'Smart Device Programmability' in VS2005. I was getting a build error (similar to one above, about not being able to find something for CFResGen). The fix was installing the compact framework (maybe the tasks are defined in another assembly, but I wasn't sure).

But I would like to say that it still works great in VS2005 'final,' and thanks for the doc.
Sunday, December 18, 2005 1:47 PM by Dan Christensen

# Thank U Thank U Thank U

Thank U for this info. It was very useful in solving a problem with compiling a C# project with MySQL .NET 1.0.7 connector on VS2005 for .NET Framework 1.1.

You are the greatest!
Sunday, January 29, 2006 7:18 AM by Pavel Myshkin

# Build .NET FW 1.1 Assemblies with VS 2005.txt

Jomo,
Thank you very much for posting this tip.
Imagine this, you are at VSLive! 2006, learning all about the wonders of VS2005 and you want to start using it right away. Problem is you have apps to support back home that sit on machines with only 1.1 installed. That's what is happening to me. It was VERY frustrating. So, I spent the evening working with your 'hack', learned some things about the environment, and now can move forward developing new apps for 2.0 and still support older ones.
Thanks --
Jay
Tuesday, January 31, 2006 1:18 AM by Jay Hamlin

# Errors during Build

I am using a full install of "Visual Studio 2005", but when i try to build i recieve the following error, in all the forms i have (they are ALL created with VS2003, and the converted by VS2005):

error: Invalid ResX input.
error: Specific exception: FileNotFoundException  Message: Invalid ResX input. ---> FileNotFoundException: File or assembly name System.Drawing, or one of its dependencies, was not found.

What can i do to resolve this issue??

Tuesday, February 14, 2006 10:16 AM by Nick

# Targeting Different Frameworks with VB.NET

SharpDevelop 2.1, revision 1157, allows VB.NET projects to target the older Microsoft Frameworks and...
Saturday, February 18, 2006 12:27 PM by Matt Ward

# Ravi K. Chodavarapu &raquo; Blog Archive &raquo; Visual Studio 2005 Compatibility Mode

# What about the final versions of Visual Studio 2005?

Is there a new version of this document matching the final release of VS.NET 2005?
Monday, March 20, 2006 4:13 AM by jwezel

# Using Whidbey Beta 2 to target .Net Runtime 1.1

J. Fisher describes how to achieve this on his blog post here
http://blogs.msdn.com/jomo_fisher/archive/2005/04/22/410903.asp...
Thursday, March 23, 2006 10:47 AM by State and Local Government Developers

# Targeting .NET Framework 1.1 with Visual Studio 2005

Very frequent question from the users of Visual Studio 2005 is &quot;what should I do to&amp;nbsp;build .NET Framework...
Thursday, April 27, 2006 5:17 PM by Visual Studio 2005 installation and usage tips

# Using Compact Framework 1.1 with Visual Studio 2005

I was recently asked if it was possible to utilise Compact Framework 1.1 with VS2005.&amp;nbsp; I recollected...
Monday, May 08, 2006 2:31 PM by Dave Baker's WebLog

# Use Visual Studio 2005 Professional Now!

Monday, May 15, 2006 2:43 PM by IWannaCode

# Can anyone tell me how to do the same but in Visual Basic

Can anyone tell me how to do the same but in Visual Basic?

if yes, please send me an email at cerb7@wp.pl

Wednesday, November 15, 2006 6:12 AM by Chris

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Thank you Jomo, very much!

This is going to have a major affect to our project.

Sunday, November 26, 2006 2:47 AM by Alex

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

<a href= http://forum.lixium.fr/cgi-bin/liste.eur?wellbut > wellbutrin medication </a> [url= http://forum.lixium.fr/cgi-bin/liste.eur?wellbut ] wellbutrin medication [/url]

Tuesday, November 28, 2006 10:42 PM by wellbutrin sr

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Today was a complete loss. I feel like a fog. I've just been hanging out doing nothing, but eh...

Wednesday, November 29, 2006 10:48 AM by Donna

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

I've just been letting everything pass me by lately. I've more or less been doing nothing. Not much going on lately. I can't be bothered with anything recently.

Thursday, November 30, 2006 1:49 PM by Linda

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

<a href= http://forum.lixium.fr/cgi-bin/index.eur?mitsu > wellbutrin sr </a> [url= http://forum.lixium.fr/cgi-bin/index.eur?mitsu ] wellbutrin medication [/url]

Thursday, November 30, 2006 8:11 PM by peter kiesewetter

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Not much on my mind recently. I haven't gotten much done. What can I say? I haven't been up to much these days, but such is life. I feel like a complete blank, but so it goes...)))

Friday, December 01, 2006 1:43 AM by Alise

# Mikle

My life's been dull. I just don't have much to say right now, but it's not important. More or less nothing seems worth thinking about.

Friday, December 01, 2006 7:05 AM by Ron

# Mikle

I just don't have much to say right now. Pretty much nothing seems worth doing. My mind is like an empty room. I haven't gotten anything done these days. What can I say?

Saturday, December 02, 2006 7:50 AM by Peter

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Good site! Well.. i like design!

Monday, December 04, 2006 9:15 AM by Mikle

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Well...good news, i like your site, Happy new year! )))

Sunday, December 10, 2006 8:26 AM by Milas

# Good site

Excellent browsing have the to

Tuesday, December 12, 2006 8:51 AM by taliawe

# Good site

Excellent browsing have the to

Thursday, December 14, 2006 1:55 AM by webmaster

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

real good news! good site, respect webmaster!

Monday, December 18, 2006 9:18 AM by Dingo

# Good site

This is a wonderful page for everyone! Please visit my site too:

<a href=  ></a> [url=][/url]

Monday, December 18, 2006 12:45 PM by Marsha

# Good site

Excellent browsing have the to

Tuesday, December 19, 2006 6:38 AM by tosc

# hello

While site keep Good work,While site keep Good work

Thursday, December 21, 2006 6:56 PM by ware,ware

# hello

Beautiful site!,Beautiful site!

Saturday, December 23, 2006 6:01 AM by chat,chat

# Good site

Very interesting.,Very interesting.

Saturday, December 23, 2006 7:18 PM by sarde,sarde

# Good site

Excellent browsing have the to

Thursday, December 28, 2006 12:42 PM by lianet

# Good site

Excellent browsing have the to

Thursday, December 28, 2006 7:59 PM by miami

# Good site

I will recomend this site... Excelent work!!! May I use your palette at my site? Thanks!,I will recomend this site... Excelent work!!! May I use your palette at my site? Thanks!

Friday, December 29, 2006 8:06 PM by [3!]fiva,[3!]fiva

# Good site

Excellent browsing have the to

Thursday, January 18, 2007 5:22 AM by card

# Good site

Excellent browsing have the to

Thursday, January 18, 2007 5:22 AM by card

# Good site

Excellent browsing have the to

Monday, January 22, 2007 8:17 AM by italiitali

# help me

Tuesday, January 23, 2007 5:02 AM by Preved

# smart link exchange

Doing correct [url=http://www.linkwizard.net]link exchange[/url] could bring a lot of traffic.

Are natural links more important then links from "link" pages or se don't care?

Sunday, January 28, 2007 10:44 PM by shutgunst1

# Good site

Monday, January 29, 2007 3:41 AM by Chuni

# Hallo! Ich habe die Seite

Good Info, I found you at the Google, thought u might wish to know.

Sunday, February 04, 2007 2:06 PM by Romanson

# its cool

This is my site:

http://32url.com/?88KM

,This is my site:

http://32url.com/?88KM

Wednesday, February 07, 2007 4:51 PM by Michael Kors

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Saturday, February 10, 2007 7:13 PM by Replicabag

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

More information, you work, stress, then you focus on a creative. Appraisal discussion, ask figure of his new overcome, or off to describe. Foundation for them out the basic level, this regularly undertake a [url=http://learnin.43i.net ]learning center.[/url].

Sunday, February 18, 2007 2:34 PM by Bill

# Good site

Best my wishes to Admin. Plz look my site too:

<a href=http://linkin-park.creablog.com>linkin">http://linkin-park.creablog.com>linkin park concert ticket</a> | [url=http://linkin-park.creablog.com]linkin park concert ticket[/url] | http://linkin-park.creablog.com - linkin park concert ticket !  Thanks.  p.s. Linkin Park Concert Ticket

Monday, February 19, 2007 10:16 AM by Linkin park

# Good site

Good Site .Nice work.,Good Site .Nice work.

Tuesday, February 20, 2007 1:34 AM by pla[3!],pla[3!]

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Lavoro eccellente! ..ringraziamenti per le informazioni..realmente lo apprezzo: D

Saturday, February 24, 2007 2:49 PM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

The information I found here was rather helpful. Thank you for this.

Monday, February 26, 2007 8:51 AM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Tuesday, March 06, 2007 6:45 PM by teroi

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

..Rather helpful information you have here. Grazie!

Tuesday, March 06, 2007 8:16 PM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

E evidente che il luogo e stato fatto dalla persona che realmente conosce il mestiere!

Tuesday, March 13, 2007 5:21 PM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

um... buoni, realmente buoni luogo e molto utile;)

Friday, March 16, 2007 2:58 AM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Lo trovo piuttosto impressionante. Lavoro grande fatto..)

Saturday, March 17, 2007 6:54 PM by ...

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Re: <a href=http://medjetnet.info/doxycycline/buy-doxycycline.html>Doxycycline</a>">http://medjetnet.info/doxycycline/buy-doxycycline.html>Doxycycline</a> is used to treat bacterial infections, including pneumonia and other respiratory tract infections; Lyme disease; acne; infections of skin, genital, and urinary systems; and anthrax (after inhalational exposure). It is also used to prevent malaria. Doxycycline is in a class of medications called tetracycline antibiotics. It works by preventing the growth and spread of bacteria. Antibiotics will not work for colds, flu, or other viral infections.

[URL=http://medjetnet.info/doxycycline/buy-doxycycline.html]buy doxycycline[/URL]|

Sunday, March 18, 2007 5:20 AM by Doxycycline

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Hi All

Why Microsoft is not supporting Framework 1.1 in visual studio. any specific Reason behind this other than business developement.

Monday, March 19, 2007 10:54 AM by Senthil kumar

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

awesome it works great.. thanks to you ill never forget this site

Monday, March 19, 2007 2:59 PM by farhan

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

I have a problem in your design. I use Firefox in Ubuntu.

Tuesday, March 20, 2007 12:10 AM by dokka

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Very ineresting web site. I like many post. I have say you THANK YOU VERY MACH

Tuesday, March 20, 2007 7:43 PM by mokka

# fitness magazine

Tuesday, March 20, 2007 10:32 PM by fitness magazine

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Thank you fpr you.I want copy this site.

Wednesday, March 21, 2007 4:21 AM by bokka

# Lucy! Please call me,my name is zet

Lucy! Please call me,Lucy! Please call me

Friday, March 23, 2007 7:29 AM by Lucy! Please call me,Jonny

# Good site

Tuesday, March 27, 2007 11:56 AM by adware remover

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Good Lord Jomo, clean this crap out...

The CSharp.Targets file was renamed between earlier Beta releases and Beta 2 of Visual Studio. Look for the file as Microsoft.CSharp.targets in the Windows\Microsoft.NET\Framework\v2.0.50215 directory. Simply update the filename of the targets file from CSharp.Targets to Microsoft.CSharp.Targets in the .csproj file.

Wednesday, March 28, 2007 6:23 PM by JustJack

# Buy Caverta,Good site

This is really fresh idea of the design of the site! I seldom met such in Internet. Good Work dude!

Monday, May 28, 2007 12:44 PM by Buy Caverta

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

Wow, to think I could have been using VS 2005 to maintain 1.1 apps ... thanks for sharing!

Monday, July 30, 2007 12:43 PM by jrummell

# All you can LINQ &raquo; The Least You Need to Know about C# 3.0

# All you can LINQ &raquo; The Least You Need to Know about C# 3.0

# All you can LINQ &raquo; The Least You Need to Know about C# 3.0

# All you can LINQ &raquo; Update: Targetting 1.1 .NET Framework with MSBuild

# 在VS2005 环境下面使用.NET Framework 1.1 进行编译(转)

这是鬼佬教的方法,原帖地址:

http://blogs.msdn.com/jomo_fisher/archive/2005/04/22/410903.aspx 由于MSBuild未能直接提供...

Tuesday, September 18, 2007 1:47 AM by 最远距离

# Mainfram Reality &raquo; Target .NET Framework 1.1 using Visual Studio 2005

# Targeting .Net Framework 1.1 for web application

Regarding instruction (3):

>>Use notepad to edit MyApp.csproj.

I've converted a web application from VS2003 to VS2005.  It no longer has a .csproj file as .csproj files have been obsoleted for these types of applications.

How do I target this app for .Net Framework 1.1?

Friday, November 16, 2007 11:19 AM by Chris Odd

# My Weblog

Monday, December 03, 2007 8:42 AM by My Weblog

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

I'm havind troubles building my solution to 1.1. All the projects are build in VS2003 and imported later. I have changed the code after. I keep getting this error: Error 3 "resgen.exe" exited with code -1163019603. FilterMonitor

It doesn't help me a lot does it?

Any suggestions?

Friday, December 21, 2007 2:42 AM by Mark Deraeve

# tech.einaregilsson.com &raquo; Blog Archive &raquo; Developing ASP.NET 1.1 in Visual Studio 2008

# re: Hack the Build: Use Whidbey Beta2 to target .NET Runtime 1.1

is there another way to build asp.net 1.1 using VS 2005 C# ? there's no csproj file in Solutions folder

Sunday, April 13, 2008 4:39 AM by pribadi dewa

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker