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.
|
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.
Sam HobbsPosted Nov 10, 2010, 2:51 PM
Use HTMLDocument instead of HTMLDocumentClass. The documentation is not as clear as it could be but the classes with a name beginnning with HTML and ending with Class are intended to be used only when the name without the Class suffix cannot be used. If my sample code uses the Class suffix then remove the Class suffix. That probably is not the solution to your problem but I wanted to mentioon it anyway.
Are you sure you have a reference to mshtml in your project? My article explains about that.
These problems are often caused when we do something undocumented to fix other problems. You might have done something that is not documented and now you are suffering from the result. If so then we can't help.
I don't know what setup software you are using. If it is a setup created by Visual Studio, then you should not need to explicitly include the Microsoft.mshtml.dll file in your setup. You should determine why the file is missing. The file should not be missing.