0

Visual Studio 2017 Professional. Native C++ project. After I have changed some of project settings project building ends with this:

Microsoft.CppCommon.targets(770,5): error MSB4018: The "VCMessage" task failed unexpectedly.
Microsoft.CppCommon.targets(770,5): error MSB4018: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Microsoft.CppCommon.targets(770,5): error MSB4018:    at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
...

PlatformToolSet mentioned here is set.

What's wrong?

Community
  • 1
  • 1
KonstantinL
  • 667
  • 1
  • 8
  • 20

3 Answers3

1

This time it is

Configuration Properties -> Linker -> Debugging -> Generate Program Database File

If the file name is omitted (while the neighbour option "Generate Debug Info" is not "No") then VS-2017 finishes building with the error MSB4018. A target is built in this case nevertheless.

KonstantinL
  • 667
  • 1
  • 8
  • 20
  • This was the solution to my problem too. Your answer saved a lot of time for me. Thank you. – Marius Bancila Sep 01 '17 at 10:49
  • This error could be generated also by incorrect settings in the project creation stage (tested on Visual Studio 2013). Check my answer here: https://stackoverflow.com/a/62918357/936700 – Gustavo Rodríguez Jul 15 '20 at 15:29
0

Right-click on the project and go to Properties > Linker > General. Then set "Output File" to "Inherit from parent or project defaults"

Vj amal's
  • 9
  • 4
0

Go to the error list window and click on the error and you may get more information. In my case it pointed to a line in Microsoft.CppCommon.targets which was an XML element. In the arguments attribute one value was %(Link.ProgramDatabaseFile) which was not set and causing the problem.

Fredrick
  • 1,210
  • 2
  • 15
  • 24