Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix Error MSB4018 in Visual Studio 2010?

error MSB4018: The "VCMessage" task failed unexpectedly. System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args) at System.String.Format(IFormatProvider provider, String format, Object[] args) at Microsoft.Build.Shared.ResourceUtilities.FormatString(String unformatted, Object[] args) at Microsoft.Build.Utilities.TaskLoggingHelper.FormatString(String unformatted, Object[] args) at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args) at Microsoft.Build.Utilities.TaskLoggingHelper.LogWarningWithCodeFromResources(String messageResourceName, Object[] messageArgs) at Microsoft.Build.CPPTasks.VCMessage.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets 990 6 vtk_minimal

like image 769
TahaYusuf Avatar asked Aug 16 '12 10:08

TahaYusuf


1 Answers

I had the same problem. I had an old Visual Studio 2005 C++ project, which I reopened with Visual Studio 2010 C++. For me, the first suggestion proposed at Microsoft Connect worked:

The issue stems from the unexpected $(TargetDir) found in the property page under Link->OutputFile. During the build process, we tried to expand the OutputFile to a fullpath but only got an empty value. Thus, it led to the index out-of-bound exception.

It is unlikely we will be able to fix these before VS2010 release. The workaround is to correct OutputPath or inherit from parent.

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

Hope that fixes it for you too.

like image 165
Diana Avatar answered Oct 04 '22 14:10

Diana