使用微软的 ildasm.exe(反编译工具),工具路径视Visual Studio的组件安装目录而定,我的是在 C:Program Files (x86)Microsoft SDKsWindowsv8.0AinNETFX 4.0 Toolsildasm.exe
打开DLL 或者EXE 文件
打开之后,再选择文件 => 转储 , 将现有的DLL文件转储,就是另存为可编辑的 .il ,存储最好另起一个文件夹,因为转储出来是N个文件,主要对 .il 文件进行修改
修改某个属性的Set方法代码,如下 将 set中的if代码段去掉,修改如下
修改完成保存即可。保存之后,需要将文件重新打包为DLL文件,使用微软 另一个工具 ilasm.exe(打包)
使用CMD命令,进入此目录
CD C:WindowsMicrosoft.NETFramework64v4.0.30319
使用命令打包,ouput:输出文件。
ilasm /dll /output=D:WY.Models.dll /Resource=C:UsersAdministratorDesktop新建文件夹aa.res C:UsersAdministratorDesktop新建文件夹aa.il
回车,可以看到,已生成新的DLL文件