Visual Studio 常见错误和异常的解决方法汇总
本文收集自己使用 Visual Studio 编程过程中遇到的错误和解决方法,包括C#语法和代码导致的异常,以及VS调试、编译器方面的各种错误提示等。部分解决方法来源于网络,恕不一一指出来源。
========================= 分 隔 符 =========================
异常:System.BadImageFormatException,未能加载正确的程序集 XXX 或其某一依赖项
环境:VS2010,C#
解决方法:
一般是由于目标程序的目标平台与其某一依赖项的目标编译平台不一致导致,把所有的项目都修改到同一目标平台下(X86、X64 或 AnyCPU)进行编译,一般即可解决问题。具体操作可参考《[VS]“Changes to 64-bit applications are not allowed”的解决方法》一文。
========================= 分 隔 符 =========================
错误:Unable to find manifest signing certificate in the certificate store
环境:VS2008,VS2010
解决方法:
如果你的项目没有经过发布,就不会有以上问题出现
方法一:把项目属性->Signing选项->Sign the ClickOnce manifests 勾去掉,这样就可以编绎通过了;
方法二:用记事本打开 *.csproj文件 ,删除下面四句代码,也可以正常编译。
[code language="xml"]
<manifestcertificatethumbprint>...</manifestcertificatethumbprint>
<manifestkeyfile>...</manifestkeyfile>
<generatemanifests>...</generatemanifests>
<signmanifests>...</signmanifests>
[/code]
==================== 分 隔 符 ====================
本文固定链接: https://blog.xieyc.com/summary-of-solutions-to-vs-errors-and-exceptions/ | 小谢的小站