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()

大概錯誤是這個樣子的,這個錯誤主要是在鏈接器的輸出路徑中,我是從一篇文章中看到的解決方案的,文章原地址如下:

https://stackoverflow.com/questions/11985085/how-do-i-fix-error-msb4018-in-visual-studio-2010/17771120

 

解決方案:項目-項目屬性-配置屬性-鏈接器-常規-輸出文件,原來是如下圖的樣子

 

點擊<繼承>的那個選項,得到結果如下圖所示:

再次運行,成功!希望能對一些人有所幫助,如有問題希望各位多指教。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM