Localizing CrystalReportViewer
I'm describing here the procedure how to localize CrystalReportViewer in .NET 1.1 framework, in an _almost_ proper way (i.e., we actually create a satellite assembly containing resources). We have to do some hacking though, because the assembly containing the English resources is strong-named, so the satellite assemblies ought to be signed by the same private key which we obviously do not have.
I will assume that you are familiar with "programming" in Command prompt and are skilled enough to solve possible problems yourself. Use at your risk only.
I'm doing this for Windows Forms version of CrystalReportViewer. I guess the same could be done for Webforms. Only replace "Windows.Forms" with "Web", and "CRViewerSys" with "ViewerSys" in all filenames.
Step 1: Extracting the resources
- Create a working directory, e.g., C:\crystalresources, and copy the file "C:\Program Files\Common Files\Crystal Decisions\1.1\Managed\CrystalDecisions.Windows.Forms.dll" (or wherever it is located) to the created directory
- Run Visual Studio .NET 2003 Command Prompt from the start menu, and change the current directory (I assume in all the following snippets that you are located in C:\crystalresources):
cd C:\crystalresources
- Disassemble the assembly. Don't extract the code, we are interested only in the resources.
ildasm CrystalDecisions.Windows.Forms.dll /OUT=CrystalDecisions.Windows.Forms.il /ITEM=
- Convert the resources to the XML format.
resgen CrystalDecisions.Windows.Forms.CRViewerSys.resources CrystalDecisions.Windows.Forms.CRViewerSys.resx
- You may delete all files in C:\crystalresources except the .resx, .il, and .dll, since we'll need them later.
Step 2: Creating the satellite assembly
- Compile the created resource file:
resgen CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resx CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resources
- Create the directory C:\vs7\keys, and create a fake key:
sn -k C:\vs7\keys\crystalpublickey.snk
- Create the satellite assembly
al /embed:CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resources /out:CrystalDecisions.Windows.Forms.resources.dll /template:CrystalDecisions.Windows.Forms.dll /culture:CULTURE
- Disassemble the created file:
ildasm CrystalDecisions.Windows.Forms.resources.dll /out=CrystalDecisions.Windows.Forms.resources.il
- Open the file "CrystalDecisions.Windows.Forms.il" in the notepad and copy the part containing the public key, something like:
.publickey = (00 00 00 ..... // ... ... // ... ... // ... AA AA AA ... ) // ...
to the clipboard. - Open the file CrystalDecisions.Windows.Forms.resources.il in the notepad, and replace the publickey block (remove the old part and paste new there).
- Compile the file.
ilasm /dll CrystalDecisions.Windows.Forms.resources.il
- Now fool the framework not to check the public key, like described here: http://www.grimes.demon.co.uk/workshops/fusionWSCrackOne.htm. So download snSig.cs and alterSn.cs to C:\crystalresources and execute:
csc /t:library snSig.cs csc alterSn.cs /r:snSig.dll alterSn CrystalDecisions.Windows.Forms.resources.dll
- Create the subdirectory CULTURE in your application directory (where your .exes and .dlls reside). Copy CrystalDecisions.Windows.Forms.resources.dll to that directory.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架