I mean... as someone who's had to port some .NET framework software to .NET 6... yes... but.
20 years old .NET framework code will keep working, sure, as long as you can find and install the correct .NET framework runtime, but maintaining it might be a different matter... you can code .NET with notepad, if you feel like it, but for .NET framework code you will need Visual Studio, with the proper SDKs... which might not be available in the latest version of Visual Studio (on occasion I've had to install VS 2019 so I could compile old .NET framework code in VS 2022).
And when you get it to compile you still might have to deal with third party tools (Crystal Reports, for instance) that don't work in modern .NET or later versions of Visual Studio...
And of course then you want to add something new to the code, which is why you went through all that trouble to begin with... but the tools for what you want to do are only available in modern .NET, or as nuget packages that won't work with framework... and you'll have to migrate the whole thing to the latest long term support version of .NET... which sure, is several orders of magnitude less work than rewriting the whole thing in some other language, and heavily automated... but is still a whole process.
But then of course there's the bits of .NET framework that got deprecated during the transition (or in later updates), or the third party libraries that never got updated... and you'll have to find or implement replacements for those...
But yeah, once you've done all that your refurbished 20 year old code will still work today, and significantly better than it did before... and if it isn't too ridden with windows dependencies (WPF and the like) it might even be portable to Linux or Mac, or whatever. And it'll probably still work (and do it even better) 20 years from now.