- 配置: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中添加和删除的文件也会自动处理