Target "build" does not exist in the project for Visual Studio
I'm checking out code for a project where contributors use different dev tools for coding in c sharp (C#). My .csproj file was manipulated by someone using Sharp develop and now I get 'The target "build" does not exist in the project'.
- How can I correct this?
I am using Visual Studio 2008 SP 1.
The accepted answer is a workaround, not a solution. You need to open the .csproj
file for editing in a text editor and ensure the following line is present in there
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
If not add it to the end.
Note: For VS2008, this may be $(MSBuildToolsPath)
I had the same problem when I upgraded a project built in VS2005 to VS2010 Express. Initially the VS2010 refused to load the project with error message "Project is not supported by this installation". After trying many solutions finally it worked and my guess is it worked when two lines were removed from the project file that related to build target. However it presented a new problem that the project would not build. Of course this makes sense as I removed the entries from project file that told Visual Studio how to build the project.
Finally got hold of another project that was working on VS2010 Express and copied following lines to the project that was failing. It worked after that.
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
Hope this helps someone.