error MSB4057: The target “v8” does not exist in the project

久未见 提交于 2019-12-24 15:13:42

问题


I'm trying to build V8 as part of ArangoDB using the official build scripts and following the official Windows build instructions.

The compilation fails for all v8* targets (v8-build.bat):

msbuild All.sln /t:v8 /p:Configuration=Release /p:Platform=x64
msbuild All.sln /t:v8_libbase /p:Configuration=Release /p:Platform=x64
msbuild All.sln /t:v8_libplatform /p:Configuration=Release /p:Platform=x64

error MSB4057: The target "v8" does not exist in the project.

If I open the solution file in Visual Studio, it looks like this:

I can build v8, v8_libbase and v8_libplatform just fine in VS.

  • Windows 7 64bit
  • Visual Studio 2013 Ultimate
  • Cygwin 2.2.0
  • cmake 3.3.1

回答1:


You can run

set MSBuildEmitSolution=1
msbuild All.sln /t:v8

Then search in the generated All.sln.metaproj file the exact target names (<Target Name="">) of all projects you want to build. v8 can have a name like _tools_\_gyp_\v8. After that you can build projects

msbuild All.sln /t:"_tools_\_gyp_\v8" /p:Configuration=Release /p:Platform=x64



回答2:


The correct way to specify a target/project if it's in a solution folder is:

msbuild all.sln /t:PATH\TO\PROJECT

But in case of (tools) and (gyp) it's simply not possible, because msbuild can't handle parentheses in the target parameter /t.

So either remove ( ) and specify the path like tools\gyp\v8, or get rid of the solution folders entirely. If the solution is flat, /t:v8 will work.

Unfortunately, both the wrapping of folder names with brackets as well as the generation of non-flat .sln are hardcoded in gyp, which generated my all.sln. There is no switch to control whether solution folders are created or not. It will create them if the target version of Visual Studio is known to support this kind of nesting.

Workaround: Force flat solution generation in gyp, see
https://github.com/arangodb/arangodb/commit/796d2d263db6271142d954c8c99b9dec0fbe75e9

Reported errors to Microsoft/msbuild and Google/gyp:

  • https://github.com/Microsoft/msbuild/issues/157
  • https://code.google.com/p/gyp/issues/detail?id=494

@dothebart and this post helped me a lot to figure it out, thank you!




回答3:


In VS2013 use

msbuild All.sln /p:Project=v8;Configuration=Release;Platform=x64


来源:https://stackoverflow.com/questions/32078468/error-msb4057-the-target-v8-does-not-exist-in-the-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!