I struggled with the same error (MSB4057: Target "_CopyWebApplication" does not exist in the project.
Yes. I used a web application project (not a website).
I was puzzled because I had one project that worked, and one that did not. So I sat down with ExamDiffPro and went to work comparing project files. I found that the assembly target section includes different ones at the bottom of the project files.
One project (working) was created using the new version of Visual Studio. Another (which did not work) was created several years ago and over the years has been updated to the current version that I am working with. The updated project, apparently, did not update with new build goals, as new versions of Visual Studio appeared.
At the bottom of the project file that worked, I found the following:
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" />
The second line of import was NOT in the project that caused the problems.
I just copied the import from the working file and pasted it into a relative location in the broken file and viola!
Although this is not a direct solution to the original problem identified in this thread, I hope this helps some other people who stumbled upon this thread looking for similar problems, only with actual web application projects.
Todd W. Powers Sep 20 2018-11-11T00: 00Z
source share