- 配置:Unity5.5.5f1 + vs2017
- 問題:更新到vs2017 15.5.0之後,項目中用到的dll調試斷點進不去了。之後更新到15.5.1,依然進不去。
- 現象:Unity工程下生成的dll文件只有dll.pdb沒有dll.mdb文件了。
原因:vs生成調試的dll後,同時會生成dll.pdb文件。Unity3d會將.pdb轉換爲.mdb格式(mono的調試文件)。
Unity自帶的轉換工具在“Unity\Editor\Data\Mono\bin\pdb2mdb.bat”。
經過測試,對於vs2017 15.5.x編譯生成的dll,Unity不會自動轉換了。解決:(然而並沒有解決)
參考大佬的解決方案,降版本到vs2017 15.0,再升降版本到vs2017 15.2版本。大佬說15.2版本比較穩定。然而也有bug,好糾結。
我個人已經選擇再安裝一個vs2015,等待vs2017+Unity可以使用的一天…
具體方法:
1.降版本到vs2017 15.0:
https://my.visualstudio.com/Downloads?q=Visual%20Studio%202017
選擇安裝vs2017 15.0版本
2.升級vs2017 15.0到15.2方法(本人沒有試):- Download the manifest file for 15.2 and put in C:\VS2017.
http://s000.tinyupload.com/?file_id=84639805684731258986 - Download Visual Studio Community installer (here) and put in the same directory.
- Open command line window (as Administrator), change directory to C:\VS2017, and type: vs_community.exe –installChannelUri “file:///C:/VS2017/ChannelManifest.json” –channelUri “https://aka.ms/vs/15/release/channel”
- You can now upgrade to 15.2!
- Download the manifest file for 15.2 and put in C:\VS2017.
- 具體相關Unity dll調試的參考鏈接:
http://www.tristancartledge.com/setting-up-and-building-a-unity-class-library/
說了怎麼編譯dll給Unity使用,和怎麼生成.mdb文件。其實dll.pdb放到Unity工程Assets下之後,會自動生成.mdb文件。如果沒有生成,就說明真的生成不了… - 關於vs和Unity編譯器
https://docs.unity3d.com/Manual/VisualStudioIntegration.html
大體意思分3點:
1.vs打開工程編譯用的自己的c#編譯器,方便查看error信息什麼的,而Unity用的是Unity自己的編譯器。
2.由於Unity用自己的編譯器,不是vs的,所以c#的一些新特性在Unity中會報錯
3.Unity自動回生成.sln和.csproj文件,在Unity中添加和刪除的文件也會自動處理