I converted a simple Net Framework 4.8 C# project to net5.0 using the dotnet tool upgrade-assistant. The project consists of one file of C# constants (not complex). The conversion went more or less okay; vs2019 only gave me framework options of NetStandard2.0 (not net5.0), so I edited the project file and added TargetPlatform>net5.0< as described elsewhere. The project compiled and built successfully.
Now for the weird part. I had some simple code in the post-build event to copy the built product dll to another output folder. BUT somewhere in the conversion process (or by VS 2019), the copy command arguments were disappeared/eaten/removed by VS. Very weird. I thought, maybe the macro names are different for the two target platforms. Sure enough. The 4.8 platform copy command looked like this and worked fine.
copy "$(TargetDir)$(TargetFileName)" %bindir%
The net5.0 command should look like this
copy "$(OutDir)$(TargetName)" ... etc
BUT when I type (actually, I don't type them; I use the "Insert" button on the editor to insert them) any variation of the quoted $(Outdir)$(Targetname) macros in the post-build editor, the editor eats them and removes them! Quotes don't matter. The editor just deletes them. Needless to say, nothing gets copied and the post-build event generates a failure message (that is useless - it just dumps the post-build commands).
I have the latest version of vs2019 running on win11. Has anyone heard of this before, and does anyone know how I might fix it? I'd like to port my other 35 solutions (which are more complex). Thank you