修正visual studio 的 “Some bytes have been replaced with the Unicode substitution character while loading file”

剛安裝visual studio去編譯, 發現以下錯誤:

Some bytes have been replaced with the Unicode substitution character while loading file C:\Users\xxxxxxxx\1305376\VariableBinder.cs with Unicode (UTF-8) encoding. Saving the file will not preserve the original file contents.

參考自這裡

大致上是說你的一些檔案被修改且取代了, 所以內容變得很奇怪visual studio無法編譯…

這個問題可能發生在各版本,

visual studio 2010 2013 2015, 因為跟系統的設置有關係啦…

解法:

Just ran into similar issue and found a way to fix it:

  1. Open “Region” from Control Panel
  2. Choose “Administrative” tab
  3. Check if  your “Language for non-Unicode programs” is any UTF-8 or Unicode language that other than English.
  4. If so, please click “Change system locale…” and change it to English.
  5. It then works after locale change and rebooting.

發表迴響