system.badimageformatexception 未能加载文件或程序集

项目是一个测试的windows服务,

 转到VS.NET的命令提示符下。cd进入到你程序的Debug文件夹下

   输入"InstallUtil xxxx.exe", 这里我的项目是FreeServices 所以输入 InstallUtil FreeServices.exe 回车后提示:system.badimageformatexception 未能加载文件或程序集

原因是项目CPU默认X86我的系统是X64,将目标平台改为 Any CPU就可以了

 

安装服务 

InstallUtil FreeServices.exe

卸载服务

InstallUtil  /u FreeServices.exe

 

原文地址:https://www.cnblogs.com/freexiaoyu/p/2652471.html