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:
- Microsoft® Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime Components
- Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation)
- Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP -Yes it’s still a CTP, there is no newer extension that I know of. Probably due to Expression Blend release.
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:
- 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 { } }
- 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.
-
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();
- 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 😉