Fengzhimei@Dot.Net
Designing My Colorful Dream
    These days I am working on some basic research on Microsoft Office Html Viewer.The Microsoft Office HTML Viewer is a HTML viewer for displaying Office documents in an HTML format.If you don't know what can the Microsoft Office HTML Viewer do for you,Click here for details on Microsoft.
    I want to a user of our application can view a document from a document library without having an application capable of displaying the requested document installed on the client computer.You know,Microsoft Windows SharePoint Services provides the Microsoft.HtmlTrans.Interface namespace to do this.So I create a web project to test its function,I want to use some members in Microsoft.HtmlTrans.Interface namespace within my sample project.
    First of all,I must declare the namespace. To do this I need to make references to the Microsoft.HtmlTrans.Interface.dll assembly,but it is not in the list of references in Vs.net.Then I look in the GAC and yes,the assembly is regedited in the GAC,but how to make a reference directly from Gac?Seems to impossible.So i think it is physically stored in some place of my disk.But after a search on my complete disk, the result is nothing.


    It seems to be much troubled,But I still believe that it is physically stored in some folder.So I decided to use Reflection to get its information,here is the code:
1Assembly mAssembly;
2string typeinfo = "Microsoft.HtmlTrans.Interface,Version=11.0.0.0,"
3 + "Culture=neutral,PublicKeyToken=71e9bce111e9429c";
4mAssembly = Assembly.Load(typeinfo);
5MessageBox.Show(mAssembly.CodeBase);
    OK, its CodeBase attribute is "c:/windows/assembly/gac/microsoft.htmltrans.interface/
11.0.0.0__71e9bce111e9429c/microsoft.htmltrans.interface.dll", So I go to the following folder:
C:\windows\assembly\gac\microsoft.htmltrans.interface\11.0.0.0__71e9bce111e9429c\
But the operating system told you that the directory is not exist, Don't worry, you can copy it in Dos mode.
    Now copy this dll into a local folder in Dos mode and reference the dll from there in VS.NET. 
    That's all about it, but I wonder why they do not leave this dll in a physically folder where we can easily find it?
posted on 2004-05-24 12:00  fengzhimei  阅读(3275)  评论(7编辑  收藏  举报