Compiling .NET 1.1 Projects In Visual Studio 2008

After having put my .NET 1.1 application running on the .NET 2.0 runtime (^), I’m planning on migrating it to .NET 2.0, but not all at once.

Because I don’t want to have 2 solutions (one on Visual Studio 2003 for the .NET 1.1 assemblies and another on Visual Studio 2008 for the .NET 2.0 assemblies) I decide to try using MSBee and have only one Visual Studio 2008 solution.

MSBee has a CodePlex project. You can download it from there or from Microsoft Downloads. Because the build on Microsoft Downloads seemed to be the most stable one, that was the one I downloaded and installed. The package comes with a Word document that explains all that needs to be done.

Before you can install and use MSBee you’ll need to install the .NET 1.1 SDK.

Having everything installed, I just opened the Visual Studio 2003 solution in Visual Studio 2008 and let it convert the solution and projects (near 30).

After the conversion, for building the projects with the .NET 1.1 C# compiler, the project files need to be edited to add the override the default targets with the MSBee ones by adding the MSBee imports after the default imports for the language:

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

Another change needed (for Visual Studio 2008 - I don't know if it was needed for Visual Studio 2005) is the tools version. MSBee needs version 2.0. To change that you'll have to change the ToolsVersion attribute of the project’s root element:

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

MSBee likes has own idea about output paths and I had set up custom output paths on my project. There’s information about this on the documentation but I decided to simply comment that out of the $(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.Common.targets file:

<!-- Paulo
<Choose>
  <When Condition=" '$(BaseFX1_1OutputPath)' == '' ">
    <PropertyGroup>
      <OutputPath>bin\FX1_1\</OutputPath>
    </PropertyGroup>
  </When>
  <Otherwise>
    <PropertyGroup>
      <OutputPath>$(BaseFX1_1OutputPath)</OutputPath>
      <OutputPath Condition=" !HasTrailingSlash('$(OutputPath)') ">$(OutputPath)\</OutputPath>
    </PropertyGroup>
  </Otherwise>
</Choose>
-->

<!-- Paulo
<PropertyGroup>
  <BaseIntermediateOutputPath>obj\FX1_1\</BaseIntermediateOutputPath>
  <IntermediateOutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
  <IntermediateOutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(BaseIntermediateOutputPath)$(PlatformName)\$(Configuration)\</IntermediateOutputPath>

  <OutputPath Condition=" '$(PlatformName)' == 'AnyCPU' ">$(OutputPath)$(Configuration)\</OutputPath>
  <OutputPath Condition=" '$(PlatformName)' != 'AnyCPU' ">$(OutputPath)$(PlatformName)\$(Configuration)\</OutputPath>
  
  <- Once OutputPath is determined, set OutDir to its value. ->
  <OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
-->

This all seemed to work fine on my old Windows XP machine without any third party Visual Studio plug-ins, but when I tried it on my Windows Vista X64 machine, I came across some problems:

  • License Compiler

    Because I'm using Infragistics' controls, there's a licences.licx file and the build will compile it. And that proved to be a problem.

    MSBee copies all the files it needs to the build process to a temporary folder, builds it in there and then copies the result to the output path.

    LC.exe seemed to never be able to find all the assemblies it needed. Searching seemed to me to be an old issue (even from the .NET 1.1 times) and the solution always pointed to not compile the license file. So, I commented that part out of the $(MSBuildExtensionsPath)\MSBee\MSBuildExtras.FX1_1.Common.targets file:

    <Target
        Name="CompileLicxFilesCondition="'@(_LicxFile)'!=''"
        DependsOnTargets="$(CompileLicxFilesDependsOn)"
        Inputs="$(MSBuildAllProjects);@(_LicxFile);@(ReferencePath);@(ReferenceDependencyPaths)"
        Outputs="$(IntermediateOutputPath)$(TargetFileName).licenses">
    
      <!--
      <LC
          Sources="@(_LicxFile)"
          LicenseTarget="$(TargetFileName)"
          OutputDirectory="$(IntermediateOutputPath)"
          OutputLicense="$(IntermediateOutputPath)$(TargetFileName).licenses"
          ReferencedAssemblies="@(ReferencePath);@(ReferenceDependencyPaths)"
          ToolPath="$(TargetFrameworkSDKDirectory)bin\">
    
        <Output TaskParameter="OutputLicense" ItemName="CompiledLicenseFile"/>
        <Output TaskParameter="OutputLicense" ItemName="FileWrites"/>
    
      </LC>
      -->
    </Target>

  • Resource Generator

    Although this worked fine on the command line, inside Visual Studio ResGen.exe would throw some error and needed to be closed.

    Looking at the Windows Application Log I found out this:

    Faulting application Resgen.exe, version 1.1.4322.573, time stamp 0x3e559b5f, faulting module MockWeaver.dll, version 0.0.0.0, time stamp 0x4adb072e, exception code 0xc0000005, fault offset 0x00018fac, process id 0x4a50, application start time 0x01ca53c14488a2fb.

    MockWeaver.dll belongs to Isolator and I just disable it when building inside Visual Studio. I was hoping to start using Isolator on this project, but, for now, I can't.

I hope this can be of some help and, if you need more, you’ll probably find it at the MSBee’s CodePlex forum.

The bottom line is: You don’t need Visual Studio 2003!

16 Responses to Compiling .NET 1.1 Projects In Visual Studio 2008

  • Thanks Paulo,

    These instructions worked perfectly.

    James

  • paulo says:

    Thanks for the feedback, James.

    Stay tunned for Visual Studio 2010…

  • Mark says:

    Paulo,

    I’ve made the changes and when I try and bring up Visual Studio 2008, it asks for the upgrade. Should I only be compiling command line?

  • paulo says:

    Mark,

    First, you must upgrade the projects from Visual Studio 2003 to Visual Studio 2008 and then make the changes.

    Do you mean that Visual Studio 2008 is asking for a second upgrade?

  • Mike Evans says:

    Paulo,

    I don’t suppose you ever got around to trying this with 2010? I (foolishly) purchased 2010 without realizing that 1.1 is not supported.

  • paulo says:

    Yes I did. It’s pretty much the same procedure.

    .NET 1.1 is only supported by Visual Studio 2003 and I don’t think they still sell it or even if the framework itself is supported.

    Both Visual Studio 2005 and 2008 only work with the 2.0 runtime, although supporting different framework (libraries) versions.

    Visual Studion 2010 supports several runtimes (2.0, 4.0, Silverlight) but 1.1 is not one of them. In my case I’m already running my code in the 2.0 runtime, I just didn’t have the time and budget to convert and test every project because they are running just fine as they are.

    A post about this is long overdue.

  • Vitali says:

    Hallo,

    so is there any chance that .NET 1.1 will run on Visual Studio 2010?

    If so, how can that be realiest?

    Sinserely yours.

  • paulo says:

    None whatsover.

    I believe .NET 1.1 support will end with the support of Windows Server 2003.

    If by “running” on VS2010 you mean “compile for”, I used the same technique for VS2010.

    If you mean debugging, you can still do all coding on VS2010 and debug using the CLR debugger installed with the .NET 1.1 SDK.

  • Vitali says:

    Hallo,

    yes you are right, that was what I meand.

    But I have a new problem. I´m trying to Build a DLL in VS 2010 the program was written in VS 2003.

    The Error:
    ‘Version 2.0 is not a compatible version.’

    Can you help me?

    Vitali

  • paulo says:

    Vitali,

    Have you followed all the steps?

    Where are you getting this error?

    Any stack trace?

  • Vitali says:

    Yes I followed all the steps ^^

    The error dissapeared after I moved all .snk to the right position.

    I´m sorry but I have a other Error.
    Maybe you can help me?

    Error: The assembly “W:\FFCommDTM\src\dtm\dotNetBased\FFCommDTM\FFCommDTM\bin\FX1_1\Debug\FFCommDTM.dll” could not be converted to a type library. Type library exporter encountered an error while processing ‘FFCommDTM.CFFDriverMain, FFCommDTM’. Error: Referenced type is defined in managed component, which is imported from a type library that could not be loaded (type: ‘CWBASEINTERFACESLib.ICWGUIConnProvider’; component: ‘W:\FFCommDTM\src\dtm\dotNetBased\FFCommDTM\FFCommDTM\bin\FX1_1\Debug\CWBASEINTERFACESLib.dll’). FFCommDTM

    Thank anyway.

  • paulo says:

    Looks like you are having some COM interop issues.

    Are all your COM dependencies registered in the machine you are building this?

    See if this can help: http://www.brianensink.com/blog/post/Runtime-Callable-Wrappers-and-their-COM-objects.aspx

  • Vitali says:

    Thank you but I fixed the bug.

    I just disabled the “Register for COM interop”.
    So it was posible for to build.
    But I also had to registrate the DLL manual ^^

    But thanks.

  • paulo says:

    Great.

  • Vitali says:

    Hallo again,

    A new problem appeard ^^

    Could not resolve mscorlib for target framework ‘.NETFramework,Version=v1.1’. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.

    The target Framework is installed.

    Can you help me with that? Would be nice.

  • paulo says:

    Strange. I had no trouble att all.

    Did you install just the framework or the complete SDK?

    Try using Aaron Stebner’s .NET Framework Setup Verification Tool (http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx) to see if everything is correctly installed.