1- try Close Visual Studio completely and Delete these cache folders:
%LocalAppData%\Microsoft\VisualStudio\<Version>\ComponentModelCache
%LocalAppData%\Microsoft\SQL Server Data Tools
2- then (Replace <Version>
with your VS version, e.g., 17.0
for VS 2022)
3- after that Reopen VS and retry publishing