There’s usually no need to set the platform
variable. Also your template file was setting it to x64 which was incompatible with arm64.
The important variable when building an executable is the rid
(runtime identifier), see my PR
After those changes it compiled just fine over here - no idea about the missing package error. I had to branch off from one commit before your main because that one seems to have syntax errors.