VS中warning MSB8004和error MSB4018解决方案
问题如下:
warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
其实这个问题很简单,因为把英文翻译过来即可,输出路径结尾缺少一个反斜线。
解决方案:项目-项目属性-配置属性-常规-输出路径,现在的路径是下图这样的:
将其改为
即可。
问题如下:
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.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray 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>d__20.MoveNext()
大概错误是这个样子的,这个错误主要是在链接器的输出路径中,我是从一篇文章中看到的解决方案的,文章原地址如下:
解决方案:项目-项目属性-配置属性-链接器-常规-输出文件,原来是如下图的样子
点击<继承>的那个选项,得到结果如下图所示:
再次运行,成功!希望能对一些人有所帮助,如有问题希望各位多指教。