win7 64位系統使用VS2010生成時出現中文目錄亂碼問題的解決方法
阿新 • • 發佈:2018-12-31
在64位的Windows 7下,用VS2010編譯4.0以前的.Net專案會有問題。原因麼,是一個叫Resgen.exe的玩意兒,是跑在64位環境下的,當他試圖載入32位的可執行程式碼時,就會執行失敗:
Failed to execute command:
""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe" (此處省略···)
解決方法:
按照官方的解決方法,直接翻譯過來
1. 關閉Visual Studio。
2. 在Visual Studio Tools子目錄,以管理員身份執行Visual Studio Command Prompt (2010),切換目錄到"<system_drive>:\Program Files (x86)\Microsoft SDKs\Windows\v<x.xx>\bin\
3. 執行命令:
corflags /32bit+ ResGen.exe /force
4. 在記事本中開啟 <project_name>.csproj 檔案
5. 新增這個屬性在PropertyGroup下面: <ResGenToolArchitecture>Managed32Bit</ResGenToolArchitecture>,然後儲存檔案。
再次嘗試編譯,一切OK!