Freigeben über


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.

Comments

  • Anonymous
    April 24, 2005
    Blog link of the week 16

  • Anonymous
    April 24, 2005
    The comment has been removed

  • Anonymous
    April 25, 2005
    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.

  • Anonymous
    May 01, 2005
    Jomo Fisher has posted an update of his build targets for VS2005 beta 2, with these, you can build apps...

  • Anonymous
    May 04, 2005
    Since the release of&amp;nbsp;beta2 of Visual Studio 2005 I have been looking for a way to code in beta2...

  • Anonymous
    May 30, 2005
    Since the release of&amp;nbsp;beta2 of Visual Studio 2005 I have been looking for a way to code in beta2...

  • Anonymous
    June 07, 2005
    Thanks for the info! Sorry to see you leave the MSBuild team

  • Anonymous
    June 22, 2005
    Very cool. Perhaps it will be possible to add Mono and IKVM targets as well!

  • Anonymous
    July 04, 2005
    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:WINDOWSMicrosoft.NETFrameworkv2.0.50215\Microsoft.CompactFramework.Build.Tasks.dll. Could not load file or assembly 'file:///C:WINDOWSMicrosoft.NETFrameworkv2.0.50215Microsoft.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 FilesMSBuildCrossCompile.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:WINDOWSMicrosoft.NETFrameworkv2.0.50215" directory. C:Program FilesMSBuildCrossCompile.CSharp.targets 113 3

  • Anonymous
    July 13, 2005
    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?

  • Anonymous
    July 20, 2005
    Is it possible? Yes, it is possible, though not without a little finesse.
    &amp;nbsp;
    Jomo Fisher has a...

  • Anonymous
    November 10, 2005
    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....

  • Anonymous
    December 18, 2005
    The comment has been removed

  • Anonymous
    January 28, 2006
    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!

  • Anonymous
    January 30, 2006
    The comment has been removed

  • Anonymous
    February 14, 2006
    The comment has been removed

  • Anonymous
    February 18, 2006
    SharpDevelop 2.1, revision 1157, allows VB.NET projects to target the older Microsoft Frameworks and...

  • Anonymous
    March 19, 2006
    PingBack from https://chodavarapuravi.wordpress.com/2005/06/16/visual-studio-2005-compatibility-mode/

  • Anonymous
    March 19, 2006
    Is there a new version of this document matching the final release of VS.NET 2005?

  • Anonymous
    March 23, 2006
    J. Fisher describes how to achieve this on his blog post here
    http://blogs.msdn.com/jomo_fisher/archive/2005/04/22/410903.asp...

  • Anonymous
    April 27, 2006
    Very frequent question from the users of Visual Studio 2005 is &quot;what should I do to&amp;nbsp;build .NET Framework...

  • Anonymous
    May 08, 2006
    I was recently asked if it was possible to utilise Compact Framework 1.1 with VS2005.&amp;nbsp; I recollected...

  • Anonymous
    November 14, 2006
    Can anyone tell me how to do the same but in Visual Basic? if yes, please send me an email at cerb7@wp.pl

  • Anonymous
    November 25, 2006
    Thank you Jomo, very much! This is going to have a major affect to our project.

  • Anonymous
    November 28, 2006
    <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]

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

  • Anonymous
    November 30, 2006
    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.

  • Anonymous
    November 30, 2006
    <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]

  • Anonymous
    November 30, 2006
    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...)))

  • Anonymous
    November 30, 2006
    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.

  • Anonymous
    December 01, 2006
    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?

  • Anonymous
    December 04, 2006
    Good site! Well.. i like design!

  • Anonymous
    December 10, 2006
    Well...good news, i like your site, Happy new year! )))

  • Anonymous
    December 12, 2006
    Excellent browsing have the to

  • Anonymous
    December 13, 2006
    Excellent browsing have the to

  • Anonymous
    December 18, 2006
    real good news! good site, respect webmaster!

  • Anonymous
    December 18, 2006
    This is a wonderful page for everyone! Please visit my site too: <a href=  ></a> [url=][/url]

  • Anonymous
    December 18, 2006
    Excellent browsing have the to

  • Anonymous
    December 21, 2006
    While site keep Good work,While site keep Good work

  • Anonymous
    December 22, 2006
    Beautiful site!,Beautiful site!

  • Anonymous
    December 23, 2006
    Very interesting.,Very interesting.

  • Anonymous
    December 27, 2006
    http://allergies-pedia.googlegroups.com/web/allergy%20asthma%20induced.html?gda=rIwMQlEAAAALW6FvpEbToAJuf0u5jX5YFRzacMt3mssOVk0t9bMaCRVJVT3hrgKrn_IySc8la3I82CZxIrPCghV5P_RnjFgqR-N6lcbUGhxyEiqiLs_zEi08VVU3fRS65b6689NGZ3Q <a href="http://allergies-pedia.googlegroups.com/web/allergy%20asthma%20induced.html?gda=rIwMQlEAAAALW6FvpEbToAJuf0u5jX5YFRzacMt3mssOVk0t9bMaCRVJVT3hrgKrn_IySc8la3I82CZxIrPCghV5P_RnjFgqR-N6lcbUGhxyEiqiLs_zEi08VVU3fRS65b6689NGZ3Q">allergy asthma induced</a>

  • Anonymous
    December 28, 2006
    Excellent browsing have the to

  • Anonymous
    December 28, 2006
    Excellent browsing have the to

  • Anonymous
    December 29, 2006
    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!

  • Anonymous
    January 17, 2007
    Excellent browsing have the to

  • Anonymous
    January 17, 2007
    Excellent browsing have the to

  • Anonymous
    January 22, 2007
    Excellent browsing have the to

  • Anonymous
    January 22, 2007
    Thank you! http://symy.jp/?Ct_220745,Thank">http://symy.jp/?Ct_220745,Thank you! http://symy.jp/?Ct_220745

  • Anonymous
    January 28, 2007
    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?

  • Anonymous
    January 28, 2007
    Nice site! http://32url.com/?iSlf,Nice">http://32url.com/?iSlf,Nice site! http://32url.com/?iSlf

  • Anonymous
    February 04, 2007
    Good Info, I found you at the Google, thought u might wish to know.

  • Anonymous
    February 07, 2007
    This is my site: http://32url.com/?88KM ,This is my site: http://32url.com/?88KM

  • Anonymous
    February 10, 2007
    Re:http://www.onlinewebservice6.de/gastbuch.php?id=128990 <a href="http://www.onlinewebservice6.de/gastbuch.php?id=128990">Replica bag, handbag</a>

  • Anonymous
    February 18, 2007
    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].

  • Anonymous
    February 19, 2007
    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

  • Anonymous
    February 19, 2007
    Good Site .Nice work.,Good Site .Nice work.

  • Anonymous
    February 24, 2007
    Lavoro eccellente! ..ringraziamenti per le informazioni..realmente lo apprezzo: D

  • Anonymous
    February 26, 2007
    The information I found here was rather helpful. Thank you for this.

  • Anonymous
    March 06, 2007
    The comment has been removed

  • Anonymous
    March 06, 2007
    ..Rather helpful information you have here. Grazie!

  • Anonymous
    March 13, 2007
    E evidente che il luogo e stato fatto dalla persona che realmente conosce il mestiere!

  • Anonymous
    March 15, 2007
    um... buoni, realmente buoni luogo e molto utile;)

  • Anonymous
    March 17, 2007
    Lo trovo piuttosto impressionante. Lavoro grande fatto..)

  • Anonymous
    March 17, 2007
    The comment has been removed

  • Anonymous
    March 19, 2007
    Hi All Why Microsoft is not supporting Framework 1.1 in visual studio. any specific Reason behind this other than business developement.

  • Anonymous
    March 19, 2007
    awesome it works great.. thanks to you ill never forget this site

  • Anonymous
    March 19, 2007
    I have a problem in your design. I use Firefox in Ubuntu.

  • Anonymous
    March 20, 2007
    Very ineresting web site. I like many post. I have say you THANK YOU VERY MACH

  • Anonymous
    March 20, 2007
    Good job! Very useful info! <a href="http://fitness-magazine.fitness-vip.info/fitness-magazine.html ">fitness magazine</a> [url=http://fitness-magazine.fitness-vip.info/fitness-magazine.html ]fitness magazine[/url] http://fitness-magazine.fitness-vip.info/fitness-magazine.html

  • Anonymous
    March 20, 2007
    Thank you fpr you.I want copy this site.

  • Anonymous
    March 22, 2007
    Lucy! Please call me,Lucy! Please call me

  • Anonymous
    March 27, 2007
    <a href="http://mywebpage.netscape.com/adware1removal/adware-se.htm">adware</a>">http://mywebpage.netscape.com/adware1removal/adware-se.htm">adware</a>  1  FREE ADWARE  2 [url=http://mywebpage.netscape.com/adware1removal/adware-se.htm]adware[/url]

  • Anonymous
    March 28, 2007
    The comment has been removed

  • Anonymous
    March 29, 2007
    Hello, <a href=http://iwrrwyjq.tripod.com/april-fools-day.html>april food fools</a> <a href=http://iwrrwyjq.tripod.com/april-fools-day.html>AprilFools</a>">http://iwrrwyjq.tripod.com/april-fools-day.html>AprilFools</a> <a href=http://iwrrwyjq.tripod.com/april-fools-day.html>April Fools Trivia</a> End ^) cya

  • Anonymous
    May 28, 2007
    This is really fresh idea of the design of the site! I seldom met such in Internet. Good Work dude!

  • Anonymous
    July 30, 2007
    Wow, to think I could have been using VS 2005 to maintain 1.1 apps ... thanks for sharing!

  • Anonymous
    July 31, 2007
    PingBack from http://linq.blogstogo.com/2007/07/31/the-least-you-need-to-know-about-c-30-5/

  • Anonymous
    July 31, 2007
    PingBack from http://linq.blogstogo.com/2007/07/31/the-least-you-need-to-know-about-c-30/

  • Anonymous
    July 31, 2007
    PingBack from http://linq.blogstogo.com/2007/07/31/the-least-you-need-to-know-about-c-30-2/

  • Anonymous
    July 31, 2007
    PingBack from http://linq.blogstogo.com/2007/07/31/update-targetting-11-net-framework-with-msbuild/

  • Anonymous
    September 17, 2007
    The comment has been removed

  • Anonymous
    November 14, 2007
    PingBack from http://edin.mainframinnovations.com/?p=226

  • Anonymous
    November 16, 2007
    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?

  • Anonymous
    December 03, 2007
    PingBack from http://ohshithedidiagain.wordpress.com/2007/12/03/17/

  • Anonymous
    December 20, 2007
    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?

  • Anonymous
    January 14, 2008
    PingBack from http://tech.einaregilsson.com/2008/01/15/developing-aspnet-11-in-visual-studio-2008/

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

  • Anonymous
    July 08, 2008
    The comment has been removed

  • Anonymous
    August 10, 2008
    And for all those who are still upgrading - this works in VS2005 Team edition for Developers - I've just done it using a new project.

  • Anonymous
    August 10, 2008
    PingBack from http://buildanddeliver.wordpress.com/2008/08/11/using-vs2005-for-net-11-apps/

  • Anonymous
    August 22, 2008
    I was trying to write that post for so long that I&#39;ve started worry that there will be new version

  • Anonymous
    August 22, 2008
    I was trying to write that post for so long that I&#39;ve started worry that there will be new version

  • Anonymous
    August 27, 2008
    Thanks for the great work on compiling CSharp targets.  I was able to use this to compile .NET 1.1 projects in VS2008. Would you happen to have a version for VB.NET? Thanks, Chris.

  • Anonymous
    January 15, 2009
    I made like in this receipt, but found out that my build dll contains reference to mscorlib of 2 versions: 1.5 and 2.0. How to avoid this 2.0 link?

  • Anonymous
    February 08, 2009
    I've having difficulty using this to compile .NET 1.1 from VS2008. The issue is it can't find ResGen (I renamed from CFResGen which didn't work either). The "ResGen" task was not found. etc. Any ideas?

  • Anonymous
    February 10, 2009
    Gestire un progetto .Net v1.1 in VS2008

  • Anonymous
    March 21, 2009
    I have a solution that has 4 projects in it.  None of the csproj files have a tag called "Import".  Where do I need to make this change?

  • Anonymous
    March 24, 2009
    <a href= http://index4.balbbes.ru >www qip</a> <a href= http://index3.balbbes.ru >monitor sniffer</a> <a href= http://index5.balbbes.ru >icq ��� mac �������</a> <a href= http://index2.balbbes.ru >������������ ����</a> <a href= http://index1.balbbes.ru >����� ������ ��������� vbulletin</a>

  • Anonymous
    June 24, 2009
    Hello, I'm trying to get this to work with VS2008. But I keep getting this problem: CSC : fatal error CS0009: Metadata file 'c:WINDOWSassemblyGAC_MSILSystem.Configuration2.0.0.0__b03f5f7f11d50a3aSystem.configuration.dll' could not be opened -- 'Version 2.0 is not a compatible version.' Does this mean that I have to install .Net Framework 1.1 SDK? Thank you very much and best regards, -Reghu

  • Anonymous
    July 01, 2009
    kameralı sesli audiovideo chat login - sohbet siteleri - odasohbeti

  • Anonymous
    October 13, 2010
    hi, i am using vs 2010 , i have a project has been written at vs 2003 .net 1.1. I want to use MSbee project , there 4 layer, 3 of them class libraries and they build perfectly. One of them Web application and it does not build. İs there any workaround it ? Or is it possible to build web applications ? I want to use vs 2010 target framework 1.1.