The Problem: You attempt to publish your C# ClickOnce application in Visual Studio 2010, but you get the “How to Fix “Cannot Publish Because a Project Failed to Build” error” error. There are no syntax errors.
The Cause: No idea
The Solution: Simply right click on the solution in the Solution Explorer, and click “Publish” – no idea why that works, but it does.
This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog
Written By Steve French

Thanks for this tip! This nonsense error was annoying me a lot!
The reason is a bug that Microsoft states that will not be solved in VS 2010.
http://connect.microsoft.com/VisualStudio/feedback/details/551674/vs-2010-rtm-returns-error-cannot-publish-because-a-project-failed-to-build-even-though-solution-builds-fine
Thanks lot for the help.it worked for me
The Cause: No idea! Realy!
But this work! Thanks!
Thanks for the help! I was attempting to publish from the Project Designer window, rather than the Wizard, as Microsoft’s solution notes.
kkkkkkkkkkk, funcionou pra mim também!!!!