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

8k views Asked by At

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:

All.sln

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
3

There are 3 answers

0
CodeManX On

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:

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

2
Dmitry Sokolov On

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
UnicornumVerum On

In VS2013 use

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