Upgrading a 20‑Year‑Old University .NET Project to .NET 6 with the .NET Upgrade Assistant
This article walks through migrating a two‑decade‑old C#/.NET university operating‑system project to .NET 6 using the .NET Upgrade Assistant, showing command‑line interactions, code adjustments, package updates, and how the final single‑file executable runs cross‑platform on Windows, Linux and Docker.
In 2001 the author created a tiny virtual operating system for a university course using C# on early .NET 1.1/2.0, later ported to VB.NET, and eventually moved to GitHub and .NET Core 2.0, making it runnable on Windows, Linux, Docker and even Raspberry Pi.
The goal of this post is to test whether the .NET Upgrade Assistant can migrate this 20‑year‑old project to .NET 6.
The upgrade is performed interactively from the command line:
$ upgrade-assistant upgrade .\TinyOS.sln
-----------------------------------------------------------------
Microsoft .NET Upgrade Assistant v0.3.256001+3c4e05c787f588e940fe73bfa78d7eedfe0190bd
-----------------------------------------------------------------
[22:58:01 INF] Loaded 5 extensions
[22:58:02 INF] Using MSBuild from C:\ProgramFiles\dotnet\sdk\6.0.100\
[22:58:02 INF] Using Visual Studio install from C:\ProgramFiles\Microsoft Visual Studio\2022\Preview [v17]
[22:58:06 INF] Initializing upgrade step Select an entrypoint
[22:58:07 INF] Setting entrypoint to only project in solution: C:\Users\scott\TinyOS\src\TinyOSCore\TinyOSCore.csproj
[22:58:07 INF] Recommending executable TFM net6.0 because the project builds to an executable
[22:58:07 INF] Initializing upgrade step Select project to upgrade
[22:58:07 INF] Initializing upgrade step Back up projectThe interactive process asks several colored questions; after the upgrade the project builds successfully with no errors.
Manual inspection of the .csproj reveals old package references from .NET Core 2 preview packages and a commented‑out <PackageReference Include="ILLink.Tasks" ... /> that is no longer needed because trimming is built into .NET 6.
Instead of fixing every reference, the author simply changes the target framework to net6.0 and rebuilds. The dotnet outdated tool is also mentioned as a convenient way to discover newer package versions.
Running the upgraded binary is straightforward:
dotnet netcoreapp2.0/TinyOSCore.dll 512 scott13.txtAfter publishing as a self‑contained single file, the executable shrinks to about 15 MB (or 11 MB with compression), runs without a separate runtime, and could even be turned into a micro‑service.
dotnet publish -r win-x64 --self-contained -p:PublishSingleFile=true -p:SuppressTrimAnalysisWarnings=trueAdding compression further reduces size:
-p:EnableCompressionInSingleFile=trueThe final result is a modern, cross‑platform .NET 6 application that preserves the original functionality of a project originally written for .NET 1.1.
Reference: https://www.hanselman.com/blog/upgrading-a-20-year-old-university-project-to-net-6-with-dotnetupgradeassistant
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.