How can I use MSHTML on a computer that doesn't have Visual Studio installed?
I am using mshtml to parse HTML in my ASP.NET-MVC application. Works great on my development machine which has VS2008 Professional installed. Works great on my staging machine that has VS Express 2008 / WebDev installed. But it throws a FileNotFoundException when trying to load a COM object on a production server that has no Visual Studio versions.
Exception type: FileNotFoundException Exception message: Could not load file or assembly
'Microsoft.mshtml, Version = 7.0.3300.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
I don't want to install Visual Studio on a box. I read the suggestion that running C: \ Program \ Common Files \ Merge modules \ vs_piaredist.exe solves this problem, but this directory does not exist in my production box. How can I use mshtml on a working machine?
a source to share
Using vs90_piaredist from dev machine seems to be the solution. The interop collection is called Microsoft.mshtml.dll and it lives in C: \ Program Files \ Microsoft.NET \ Primary Interop Assemblies. Running vs90_piaredist created this directory on the production machine and placed 5 internetworking libraries there, including Microsoft.mshtml.dll.
This thread had a good discussion of this issue.
a source to share
IE is unmanaged code, so an interop layer must exist to transition from managed to unmanaged. The Primary Interop Assembly (PIA) is the one that is usually shipped by the supplier. This is why you are prompted to run piaredist.exe
a source to share