Converts legacy .NET project files (.csproj, .fsproj, .vbproj) to modern SDK-style format...
Required Reference: Before proceeding, consult the .NET SDK-style project documentation for authoritative guidance on SDK-style projects.
Analyze project files to recommend the appropriate SDK:
| Project Type | SDK | Indicators |
|---|---|---|
| Console/Library | Microsoft.NET.Sdk |
No web/UI references |
| ASP.NET Core/Web API | Microsoft.NET.Sdk.Web |
Microsoft.AspNetCore.*, Startup.cs, Controllers |
| Razor Class Library | Microsoft.NET.Sdk.Razor |
.razor files, Razor components |
| Blazor WebAssembly | Microsoft.NET.Sdk.BlazorWebAssembly |
Microsoft.AspNetCore.Components.WebAssembly |
| Worker/Background Service | Microsoft.NET.Sdk.Worker |
IHostedService, BackgroundService |
| WinForms | Microsoft.NET.Sdk + <UseWindowsForms> |
System.Windows.Forms |
| WPF | Microsoft.NET.Sdk + <UseWPF> |
PresentationFramework, .xaml files |
| MSTest | MSTest.Sdk |
Microsoft.VisualStudio.TestTools.UnitTesting |
| .NET Aspire AppHost | Aspire.AppHost.Sdk |
Aspire orchestration project |
Before upgrading, analyze and review:
net9.0, net48)packages.config or <Reference> with HintPath#if directives, DEBUG/RELEASE configurations<PreBuildEvent> or <PostBuildEvent>.targets or .props file imports.resx files, embedded resources, content filesOutputPath, IntermediateOutputPathIdentify SDK: Analyze references and file patterns to determine SDK
Create minimal project file:
<Project Sdk="SELECTED_SDK">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
Add OutputType if executable: <OutputType>Exe</OutputType> or <OutputType>WinExe</OutputType>
Migrate PackageReferences: Convert packages.config or HintPath references
Remove redundant elements: SDK-style auto-includes *.cs, *.resx, etc.
Add desktop properties for WinForms/WPF:
<UseWindowsForms>true</UseWindowsForms>
<!-- or -->
<UseWPF>true</UseWPF>
<Compile Include="**/*.cs" /> needed (auto-included)<GenerateAssemblyInfo>true</GenerateAssemblyInfo> default)After upgrade, run:
dotnet build
dotnet msbuild -preprocess:output.xml # View expanded project