Microsoft.Mshtml.dll deployment issue.

Nov 10 2010 10:30 AM
When  I install my solution on the client's computer, I get an error stating the file Microsoft.mshtml.dll is not found. 
What I did, I included the file during the setup, the file not found exception is not occuring anymore BUT there is another exception...

Here is my code and the exception.

 mshtml.HTMLDocumentClass iDoc = (mshtml.HTMLDocumentClass)this.axWebBrowser1.Document;
object iDisp = iDoc.Script; // get the script object
Type tp = iDisp.GetType(); // get its type
string theKey = getKeyFromBody(iDoc.documentElement.innerHTML.ToString());

This all work on my machine (developer machine), but generates the following exception on client's machine :

Exception Unable to cast COM object of type 'System.__ComObject' to class type 'mshtml.HTMLDocumentClass'.
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.-


So now my REAL question is, how can I deploy my solution and being absolutely certain all calls or actions upon this freaking mshtml.dll behaves correctly.

This must be all deployment issue since it's working fine on my machine.  Some people said in other forums to use System.windows.forms.htmldocument...  But this class doesn't have Script object... 

Thanks for guiding me, I just hit a pitfall... 
Sorry for my english francais étant ma langue maternelle.

Answers (1)