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
最佳答案
我有同样的问题。我有一个旧的 Visual Studio 2005 C++ 项目,我用 Visual Studio 2010 C++ 重新打开了它。对我来说,第一个建议是在 Microsoft Connect工作:
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.
右键单击该项目,然后转到“属性”>“链接器”>“常规”。然后将“输出文件”设置为“<从父级或项目默认值继承>”
希望也能帮您解决。
关于visual-studio - 如何修复 Visual Studio 2010 中的错误 MSB4018?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11985085/