Hi,
Not sure if this is the right group for this but I think it could
loosely be described as an interop problem since it is the interop dll
I can't get to work.
Can anyone tell me how to install the Microsoft.mshtml.dll correctly?
I am running VS2005.
I have a C# project which uses mshtml and works perfectly on my
machine.
I have installed it and everything works except the mshtml calls.
I get the following error:
System.InvalidCastException: Unable to cast COM object of type
'System.__ComObject' to class type 'mshtml.HTMLAnchorElementClass'.
COM components that enter the CLR and do not support IProvideClassInfo
or that do not have any interop assembly registered will be wrapped in
the __ComObject type. Instances of this type cannot be cast to any
other class; however they can be cast to interfaces as long as the
underlying COM component supports QueryInterface calls for the IID of
the interface.
I am referencing and installing the version from of the interop dll
from "C:\Program Files\Microsoft.NET\Primary Interop Assemblies".
I have tried copying it into "\Windows\assembly" and it made no
difference.
I have tried creating my own version of the dll (both sign and
unsigned) and it made no difference.
I have found a lot of questions about this sort of mshtml problem on
the groups but no answer.
If I install Visual Studio it'll work so I assume Visual Studio knows
how to install it correctly and I hope that means it is documented
somewhere.
Any help appreciated because I am completely out of ideas.
Thanks, Vin
jiangsheng[MVP] - 07 Nov 2006 17:18 GMT
I guess you can put mshtml in gac.

Signature
Regards
Sheng Jiang
Microsoft Most Valuable Professional in Visual C++
http://www.jiangsheng.net
> Hi,
>
[quoted text clipped - 40 lines]
>
> Thanks, Vin
Vincent Finn - 08 Nov 2006 17:47 GMT
>I guess you can put mshtml in gac.
Is that not the same as copying it into \Windows\Assembly?
gacutil.exe isn't installed on the machine by the .Net 2 installer.
Is there another way of adding it to the GAC?
Vin
Vincent Finn - 13 Nov 2006 10:47 GMT
>>I guess you can put mshtml in gac.
>
>Is that not the same as copying it into \Windows\Assembly?
>
>gacutil.exe isn't installed on the machine by the .Net 2 installer.
>Is there another way of adding it to the GAC?
Did a little reading and found that RegASM.exe is the .Net 2 app for
registering in the GAC which is where I as going wrong.
And that solves my problem.
Thanks, Vin