.NET 3.0 development in Visual Studio 2005

Today i finally managed to convince my VS 2005 to create a .NET 3.0 projects.

I not exactly sure what combinations of install/uninstall did the trick… here are extensions that I suspect should be enough:

Those enable .NET 3.0 project templates, thus enable you to create new .NET 3.0 projects…. but what with migration? To be able to create XAML forms in my existing Windows.Forms application I have did the following:

  1. Added almost default App.XAML and App.XAML.CS files:
    <Application x:Class="Project.Client.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        StartupUri="Forms/MainBox.xaml"
        >
        <Application.Resources>
    
        </Application.Resources>
    </Application>
    
    using System;
    using System.Windows;
    using System.Data;
    using System.Xml;
    using System.Configuration;
    
    namespace Project.Client {
        public partial class App : System.Windows.Application {
    
        }
    }
    
  2. Modified csproj project file:
        <ProjectGuid>{CC7F9AC7-2A90-4AF3-8990-00786DC6DD35}</ProjectGuid>
        <OutputType>WinExe</OutputType>
        [...]
      <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
      <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    

     

        <ProjectGuid>{CC7F9AC7-2A90-4AF3-8990-00786DC6DD35}</ProjectGuid>
        <OutputType>WinExe</OutputType>
        <MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
        [...]
      <Import Project="$(MSBuildBinPath)Microsoft.CSharp.targets" />
      <Import Project="$(MSBuildBinPath)Microsoft.WinFX.targets" />
      <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
    
  3. Replace Application.Run() (and friedns) this this this code to application Main method:

        App app = new App();
        app.InitializeComponent(); // R# 2.5 will mark this as an error, ignore it
        app.Run();
    
  4. Replace my usual main window form with MainBox.xaml.

Phew! Now I have to make my NAnt scripts support NET 3.0 projects and XAML compilation 😉

Leave a Reply

Back to Top