📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Before you migrate a .NET Framework application to .NET 10, how do you do the compatibility analysis? What do you check in the dependencies, the APIs you call, the NuGet packages and any Windows-only code, which tools do you use, and what does the output of that analysis look like?

Covers compatibility analysis before a .NET Framework to .NET 10 migration: dependency graphs, unsupported APIs (System.Web, WCF server, AppDomains, remoting), NuGet package support, Windows-only code, the tooling (GitHub Copilot app modernisation, the legacy Upgrade Assistant analyser, platform compatibility analysers) and turning findings into a migration backlog.

Intermediate Theory Intermediate compatibility-analysis copilot-modernisation dotnet-framework legacy-migration nuget upgrade-assistant

🎯 Key points

  • Map the project dependency graph and migrate leaves first (class libraries before the web app)
  • Flag APIs with no .NET 10 equivalent: System.Web, WCF server, AppDomains, .NET Remoting, Code Access Security, WF, BinaryFormatter
  • Check every NuGet package for a netstandard2.0 or net8.0+ build, an alternative, or a fork; treat NU1701 as a finding
  • Find Windows-only code with the platform compatibility analyser (CA1416): registry, WMI, EventLog, System.Drawing, COM
  • Windows Compatibility Pack (Microsoft.Windows.Compatibility) restores ~20,000 Framework APIs as packages, but many are Windows-only: a bridge, not a destination
  • Use GitHub Copilot app modernisation (Microsoft Learn marks the .NET Upgrade Assistant deprecated) plus manual review
  • Iterative and documented: a costed backlog (blockers, replacements, effort, risk) revisited each increment
  • Characterisation tests and a production baseline before any code moves

⏱ 30-second answer

Compatibility analysis answers "what breaks, and how much will it cost to fix?" before anyone changes a project file. I map the project dependency graph so I can migrate leaves first, then check three things per project: APIs with no .NET 10 equivalent (System.Web, WCF server hosting, AppDomains, Remoting, CAS), NuGet packages without a netstandard2.0 or modern target, and Windows-only code (registry, WMI, System.Drawing, COM) that the CA1416 platform analyser flags.

Tooling helps: GitHub Copilot app modernisation is Microsoft's current assistant (the .NET Upgrade Assistant was deprecated in late 2025), and analysers find the rest. The output is a costed backlog of blockers, replacements and effort per project. The trade-off: a week of analysis feels slow, but it is far cheaper than discovering a blocker halfway through a migration.

🗣 Full answer (senior)

How I would answer this in an interview

"Compatibility analysis is the step that turns 'let's move to .NET 10' into a plan with a cost. I start with the dependency graph: which projects reference which, and which NuGet packages each one pulls in. Migration goes bottom-up, so leaf class libraries come first and the ASP.NET app comes last. Then for each project I look at three things. First, APIs that simply don't exist on modern .NET: anything in System.Web, WCF server hosting, AppDomain.CreateDomain, .NET Remoting, Code Access Security, Workflow Foundation. Second, packages: does each one ship a netstandard2.0 or net8.0+ build, is there a maintained replacement, or is it abandoned? Third, platform: code that touches the registry, WMI, the Windows Event Log, System.Drawing or COM still runs on .NET 10, but only on Windows, and the CA1416 analyser tells me where it is.

For tooling, Microsoft's current answer is GitHub Copilot app modernisation in Visual Studio; the old .NET Upgrade Assistant was deprecated in late 2025 and is only there as a legacy option. I treat any tool's report as a starting point, not the answer, because it can't see reflection, config-driven type loading or behaviour differences like culture or ordering.

The mistake I see is teams skipping straight to retargeting and discovering at week six that a payment SDK only ships for .NET Framework. The output I want is a costed backlog: blockers, the replacement for each, effort per project, and what can run on Linux. That backlog is what the business funds."


What to check, and what it usually means

Area What you look for Typical finding Usual answer
Project graph References between projects 40 projects, 6 leaves with no deps Migrate leaves first, multi-target them
Framework APIs System.Web, WCF service hosting, Remoting, AppDomains, CAS, WF HttpContext.Current in 300 places System.Web adapters, refactor to DI
NuGet packages Target frameworks in each package Old PDF library is net45-only Upgrade, replace, or isolate behind a service
Windows-only APIs Registry, WMI, EventLog, System.Drawing, COM interop Reports use System.Drawing Stay on Windows for now or swap to SkiaSharp/ImageSharp
Configuration web.config sections, custom config handlers Custom ConfigurationSection classes Move to appsettings.json + options
Runtime behaviour Globalisation (ICU vs NLS), BinaryFormatter, default TLS BinaryFormatter used for cache Replace; it is removed in .NET 9+

Tools and what each one is good for

Tool Good for Blind spot
GitHub Copilot app modernisation (VS 2026 / VS 2022 17.14.16+) Assessment report, plan, automated project edits Needs a paid Copilot plan; still needs human review
Legacy .NET Upgrade Assistant (deprecated, opt-in) Offline analysis where Copilot isn't allowed No longer developed
Platform compatibility analyser (CA1416) Windows-only call sites Only after the project builds on modern .NET
dotnet list package --outdated / --vulnerable Package versions and CVEs Doesn't tell you about target frameworks
NuGet.org "Frameworks" tab Which TFMs a package supports Manual

Production example

On a 38-project line-of-business system, the analysis took about eight days and found three real blockers: a net40-only reporting library, BinaryFormatter in the session cache, and 280 uses of HttpContext.Current. Costing those up front changed the plan from "six weeks" to "five months, incremental", and the migration then landed within 10% of the estimate.

🔍 What the interviewer is checking

Checks that the candidate can scope a migration methodically before touching code, and knows which Framework features don't exist on modern .NET.

Green flags

  • Starts with the dependency graph and migrates bottom-up
  • Names concrete missing APIs (System.Web, WCF server, AppDomains, Remoting, BinaryFormatter)
  • Knows the tooling is current (Copilot app modernisation, Upgrade Assistant deprecated) and its limits
  • Produces a costed backlog and a baseline

Red flags

  • "Just change the target framework and fix the errors"
  • Thinks everything Windows-only must be rewritten
  • No mention of packages or behaviour differences

📚 Learn in depth

1. Why compatibility analysis exists

.NET Framework 4.8.x and .NET 10 share a language and most of the base class library, but not the whole surface. Modern .NET was rebuilt for cross-platform hosting and side-by-side deployment, so some Framework features were deliberately left out:

.NET Framework 4.8.1                 .NET 10
----------------------------------   ----------------------------------
System.Web (IIS-integrated)          ASP.NET Core (Kestrel, middleware)
WCF client + server                  WCF client packages; server = CoreWCF
AppDomains (isolation, unload)       AssemblyLoadContext (no isolation)
.NET Remoting                        gRPC / HTTP
Code Access Security                 OS-level sandboxing / containers
Workflow Foundation                  CoreWF (community) / redesign
BinaryFormatter                      Removed (throws) from .NET 9

Anything in the left column with no right-hand answer is a blocker that needs design work, not a retarget.

2. The dependency graph decides the order

Migration works bottom-up because a net10.0 project can reference a netstandard2.0 library, but a .NET Framework app can't reference a net10.0-only library.

   Web.Mvc (net48)            <- migrate last (or strangle)
     |        \
 Services (net48)   Reporting (net48, System.Drawing)
     |
 Domain (net48)               <- leaf: multi-target first

The usual trick is to multi-target leaves (<TargetFrameworks>net48;net10.0</TargetFrameworks>) or retarget them to netstandard2.0, so both the old and the new app can use them during the transition.

3. Packages

For each package you need one of:

  1. A newer version with a netstandard2.0, net8.0 or later target.
  2. A maintained replacement (e.g. Microsoft.ApplicationInsights.Web gives way to OpenTelemetry or the Azure Monitor distro).
  3. Isolation: keep the old library inside a small .NET Framework service and call it over HTTP.

The .NET Framework compatibility shim lets a modern project reference a net4x package, with warning NU1701. It often compiles and then fails at run time when the package touches System.Web or another missing API. Treat NU1701 as a finding, not a fix.

4. Windows-only code and the Compatibility Pack

.NET 10 runs on Windows, Linux and macOS. The Windows Compatibility Pack (Microsoft.Windows.Compatibility) is a meta-package that brings back about 20,000 .NET Framework APIs: registry, WMI (System.Management), EventLog, System.Drawing.Common, Directory Services, code pages and more. Some are cross-platform, but many only work on Windows and throw PlatformNotSupportedException elsewhere (System.Drawing.Common is Windows-only from .NET 7). The CA1416 analyser marks each Windows-only call site once the project builds against net10.0. You then decide: stay on Windows (App Service for Windows, Windows containers), or replace the API.

If Linux is the goal, also check things no analyser flags:

  • File paths: hard-coded \ separators and drive letters; use Path.Combine.
  • Case-sensitive file systems: Views\Home.cshtml vs views/home.cshtml.
  • Line endings and encodings in files your code parses.
  • Time zones: Windows IDs (AUS Eastern Standard Time) vs IANA IDs (Australia/Sydney); .NET 6+ converts between them, but stored IDs may not round-trip.
  • Integrated Windows authentication to SQL Server needs Kerberos setup on Linux; managed identity is usually simpler in Azure.

5. Behaviour differences the tools miss

  • Globalisation: .NET 5+ uses ICU on all platforms by default (and on Windows 10 1903+), so string comparison and culture formatting can change.
  • Default serialisation: System.Text.Json is stricter than Newtonsoft.Json about casing and types.
  • Reflection-driven loading: types named in config files won't show up in static analysis.
  • TLS and crypto defaults follow the OS.

These need characterisation tests (tests that record current behaviour) and a production baseline (latency, error rate) captured before you start.

6. Turning findings into a living backlog

A useful report lists, per project: target framework plan, blockers with a proposed solution, package actions, Windows-only call sites, effort in days, and risk. That becomes epics in the backlog and the basis for the business case. It is iterative: each migrated project reveals new findings, so re-run the analysis at the start of each increment and record the big decisions (stay on Windows, replace a package, isolate a library) in ADRs so the next team knows why.

Try it yourself

  1. Take an old net48 class library, convert it to SDK style (by hand or with try-convert), set <TargetFrameworks>net48;net10.0</TargetFrameworks>, and read every build error.
  2. Set <AnalysisLevel>latest-recommended</AnalysisLevel> and count CA1416 warnings in the net10.0 build.
  3. Run dotnet list package --include-transitive and check three packages' supported frameworks on NuGet.org.
  4. Write a characterisation test that formats a date and a currency with CultureInfo("en-AU") on net48 and net10.0 and compare the output.
  5. Run Copilot app modernisation's assessment (if you have a licence) on the same solution and compare its list with yours.

💻 Code

Multi-targeting a leaf library so both the old and new apps can use it while you work through the findings:

<!-- Domain.csproj: SDK-style, built for both runtimes during the transition -->
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net48;net10.0</TargetFrameworks>
    <LangVersion>latest</LangVersion>
    <Nullable>enable</Nullable>
    <!-- Surface Windows-only calls (CA1416) and other modern analysers -->
    <AnalysisLevel>latest-recommended</AnalysisLevel>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
  </PropertyGroup>

  <!-- Only the old target needs the Framework reference -->
  <ItemGroup Condition="'$(TargetFramework)' == 'net48'">
    <Reference Include="System.Configuration" />
  </ItemGroup>
</Project>

Isolating a Windows-only call so the rest of the code stays portable, and so the analyser has one place to look:

namespace Contoso.Domain.Platform;

using System.Runtime.Versioning;
using Microsoft.Win32;

public interface IMachineSettings
{
    string? GetLegacyInstallPath();
}

// The attribute tells CA1416 this type is Windows-only, so callers are checked.
[SupportedOSPlatform("windows")]
public sealed class RegistryMachineSettings : IMachineSettings
{
    public string? GetLegacyInstallPath() =>
        Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Contoso", "InstallPath", null) as string;
}

// Portable replacement used on Linux and in containers.
public sealed class ConfigMachineSettings(string? installPath) : IMachineSettings
{
    public string? GetLegacyInstallPath() => installPath;
}

Commands I run during the analysis:

# Every package, including transitive ones, per target framework
dotnet list package --include-transitive

# Known vulnerabilities (fix these regardless of the migration)
dotnet list package --vulnerable --include-transitive

# Build the modern target only and collect analyser warnings
dotnet build -f net10.0 -warnaserror- /p:AnalysisLevel=latest > build-net10.txt

⚠ Common mistakes

  • Mistake: Retargeting the web project first. Why it is wrong: it depends on everything else, so nothing builds and you learn little. Instead: migrate bottom-up, multi-targeting leaf libraries first.
  • Mistake: Treating the tool report as complete. Why it is wrong: tools miss reflection, config-driven type loading and behaviour changes such as ICU globalisation. Instead: combine tooling with code review and characterisation tests.
  • Mistake: Treating the analysis as a one-off document. Why it is wrong: each migrated project exposes new findings, and a stale report misleads the estimate. Instead: keep the findings in the backlog or an ADR and revisit them at the start of every increment.
  • Mistake: Ignoring NU1701 warnings. Why it is wrong: the package compiled against .NET Framework and may fail at run time when it calls a missing API. Instead: list every NU1701 as a finding and find a supported version or replacement.
  • Mistake: Assuming Windows-only means unsupported. Why it is wrong: registry, WMI and EventLog work fine on .NET 10 on Windows. Instead: decide deliberately whether Linux hosting is a goal, and isolate Windows calls behind interfaces if it is.
  • Mistake: Isolating Windows-only code and not testing the replacement. Why it is wrong: the portable implementation (config instead of registry, ImageSharp instead of System.Drawing) can behave differently. Instead: run the same tests against both implementations, and on Linux in CI if Linux is the target.
  • Mistake: Adding the Windows Compatibility Pack and calling it done. Why it is wrong: it brings back Framework APIs as packages, but many of them still only work on Windows, so it hides platform coupling. Instead: use it as a stepping stone with a tracked list of what still depends on it.
  • Mistake: Not capturing a baseline. Why it is wrong: you can't prove the new version is as fast or as correct. Instead: record p95 latency, error rate and key business outputs before the first change.
  • Mistake: Missing BinaryFormatter. Why it is wrong: it throws from .NET 9, often in caching or session code that only runs in production. Instead: search for it explicitly and plan a serialiser change.

🏛 Senior insight: trade-offs

Senior engineers treat compatibility analysis as a business artefact, not a technical chore. Its real job is to turn an open-ended request into an estimate with named risks, so the business can decide whether to fund an incremental migration, keep the app on .NET Framework 4.8.1 (still supported as a component of Windows), or retire it. A good report says what not to migrate as well.

I time-box the first pass (two weeks is usually enough to find the blockers that change the plan) and then keep it alive: findings are revisited each increment, and the decisions are written down in ADRs. On tooling, Microsoft Learn now marks the .NET Upgrade Assistant as deprecated in favour of GitHub Copilot app modernisation (which needs a paid Copilot plan); the legacy assistant can still be enabled in Visual Studio for teams without Copilot access.

Finding When it fits Cost When not to
Retarget in place Library uses only portable APIs Low Heavy System.Web or WCF server code
Replace the package Maintained alternative exists Medium (behaviour testing) Package encodes complex business rules
Isolate behind a service Abandoned Windows-only library Medium, adds a network hop Called in a hot loop
Stay on .NET Framework 4.8.1 Stable app, low change rate Low now, rising skills risk Needs Linux, containers or new features

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions multi-targeting or netstandard2.0 for shared libraries Why: Checks they know when netstandard2.0 still makes sense versus multi-targeting
    How to answer

    .NET Standard is an API contract implemented by several runtimes, created before .NET 5 unified the platform. netstandard2.0 is supported by .NET Framework 4.6.1+ (4.7.2+ recommended) and every modern .NET, so one library binary works in both. Target it when the library must still serve .NET Framework apps (for example shared business rules during a gradual migration) and only needs the common API surface. Multi-target (net48;net10.0) when you need runtime-specific APIs or want .NET 10's performance features (spans, newer collections, TimeProvider) on the modern side, using #if NET for the differences. There will be no new .NET Standard versions, and 2.1 isn't supported by .NET Framework, so libraries with no Framework consumers should simply target net10.0. The trade-off: wider compatibility versus access to modern APIs.

  2. When: Candidate mentions converting projects before analysing them Why: Checks they understand SDK-style projects, which most modern tooling needs
    How to answer

    An SDK-style project begins with <Project Sdk="Microsoft.NET.Sdk">. That one attribute pulls in all the standard build logic, so the file only holds what's specific to your project: the target framework, the output type, a few settings and its references. Source files are picked up automatically by globbing, so you don't list each .cs file. Packages are PackageReference items. Old-style .NET Framework project files listed every file, imported targets by hand and used packages.config. That made them long, noisy in merges and tied to Visual Studio on Windows.

  3. When: Candidate suggests staying on .NET Framework for some apps Why: Checks they know the support lifecycle of .NET Framework 4.8.1 versus modern .NET
    How to answer

    .NET Framework (1.0 in 2002 to 4.8.1) is the original Windows-only runtime. It is now in maintenance mode: security and reliability fixes only, shipped as a Windows component, and supported as long as the Windows version it runs on is supported.

    Modern .NET (.NET Core 1.0 in 2016, renamed .NET 5 in 2020, now .NET 10 LTS) is a rewrite: cross-platform, open source, installed side by side, much faster, and released every November. LTS releases get 3 years of support from release, STS releases 2 years.

    Both exist because thousands of business apps were built on Framework technologies that never moved across (Web Forms, WCF server, System.Web). The trade-off: Framework is stable and supported, but the cost and risk of staying rise every year as libraries drop Framework targets, skills move to modern .NET, and every new feature and performance gain lands only on modern .NET.

↩ Usually asked after

More in Migration Topics

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me