Target “build” does not exist in the project for V

2019-01-23 10:25发布

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.

3条回答
乱世女痞
2楼-- · 2019-01-23 11:18

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.

查看更多
孤傲高冷的网名
3楼-- · 2019-01-23 11:21

If you were to do it manually, I would take all the files and add them back to a new project file one by one.

查看更多
时光不老,我们不散
4楼-- · 2019-01-23 11:24

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)

查看更多
登录 后发表回答