This is a common error when new programmers face in Visual Studio when publish your apps.
Error 1 Cannot publish because a project failed to build.
Warning 3 Item 'Microsoft.Net.Framework.3.5.SP1' could not be located in 'C:\xxx
Warning 4 Item '.NETFramework,Version=v4.0,Profile=Client' could not be located in 'C:\xxxx
Error 5 Could not find required file 'setup.bin' in 'C:\Users\Alan\Documents\Visual Studio 2010\Projects\<Project Name>\<Project Name>'.
Stay cool and try below steps:
The thing is actually you have enabled the Prerequisites.
Most system now already have the basic installations. So, this step can skip.
What you have to do is untick "Create setup program to install prerequisites components"
Then, publish now.
Unless your coding is having error else this should works.