From google, this seem to be the most promising thread:
Yes, I had googled and found the same result/thread (before I posted on this forum). I have followed advice for deleting the DesignTimeBuild folder - but that doesn't get rid of the error. Apart from manually rebuilding the project afresh, I can't think of anything to get rid of this error.
This may be a bug with Visual Studio 2022 and nothing to do with ESRI add-in project templates in any case.
Would be interesting to know if this has happened to other people once they have migrated their projects to 3.