• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
洛客
追求完美的用户体验。
博客园    首页    新随笔    联系   管理    订阅  订阅

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

  1. 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
  2. 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
        
  3. 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=
        
  4. Convert the resources to the XML format.
    resgen CrystalDecisions.Windows.Forms.CRViewerSys.resources CrystalDecisions.Windows.Forms.CRViewerSys.resx
        
  5. You may delete all files in C:\crystalresources except the .resx, .il, and .dll, since we'll need them later.
You have extracted resources to the .resx file. Create a localized version to the file "CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resx" where CULTURE is the desired culture (for example sk-SK). Of course, replace CULTURE with the same culture in all commands below.

Step 2: Creating the satellite assembly

  1. Compile the created resource file:
    resgen CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resx CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resources
        
  2. Create the directory C:\vs7\keys, and create a fake key:
    sn -k C:\vs7\keys\crystalpublickey.snk
        
  3. 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
        
  4. Disassemble the created file:
    ildasm CrystalDecisions.Windows.Forms.resources.dll /out=CrystalDecisions.Windows.Forms.resources.il
        
  5. 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.
  6. Open the file CrystalDecisions.Windows.Forms.resources.il in the notepad, and replace the publickey block (remove the old part and paste new there).
  7. Compile the file.
    ilasm /dll CrystalDecisions.Windows.Forms.resources.il
        
  8. 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
        
  9. Create the subdirectory CULTURE in your application directory (where your .exes and .dlls reside). Copy CrystalDecisions.Windows.Forms.resources.dll to that directory.
Repeat step 2 for every culture you want to localize.
posted @ 2008-06-05 22:00  洛客  阅读(455)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3