Resolved: I am getting this error publishing an ASP.Net web project: “%(FullPath)” cannot be applied to the path

In this post, we will see how to resolve I am getting this error publishing an ASP.Net web project: “%(FullPath)” cannot be applied to the path

Question:

I am working two ASP.Net Web apps. After some edits and updates I wanted to publish one and deploy for testing using own local host PC as the server. Previously publishing it worked in VS 2022. But after I installed IIS and added it as an application I could not publish it from Visual Studio. I tried removing the app. from IIS and manually setting the publish path. I also uninstalled IIS and restarted the PC.
The Output error I get is:
The item metadata “%(FullPath)” cannot be applied to the path “C:\Users…\AppData\Local\Temp…
Anyone know of a way to correct this?

Best Answer:

Update:
I was able to fix the problem by deleting ‘FolderProfile.pubxml’ and ‘FolderProfile.pubxml.user’ in the Project \PublishProfiles sub-folder.
I also deleted the ‘website.publishProj’ file from the main project folder.
This cleared the publish settings and fixed the problem.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com