In my VS2012 project with Internet Explorer 10 installed if I add a reference by going to the COM references and choose MSHTML then it gives me the version that is installed in the GAC which is an old 7.0.3300.0. If I actually look in system32 or sysWOW64 then the .dll tlb version is a much much newer version.
How should I develop against the newer version?
If I understand it correctly mshtml is installed with Internet Explorer so if my deployment machines have IE10 then I should have no problems right?
Can anyone guess why the GAC has the old version in it? I have just check 2 other Win 7 installs and it is the same. GAC is 7.0.3300.0 but elsewhere it matches the IE version.
EDIT: The other Win 7 machines all have VS installed. I just looked on another Win 7 and there is nothing in the GAC. Is VS2012 installing this in the GAC?
Update after Comment It appears that there are a few questions about this. this reference from the comment also this question which Hans was also involved in. I also found this forum thread as well on the topic.
I still down know what I should be doing, but I can certainly simply follow like a sheep the instructions. I suppose I need to create a PIA that will allow me to call the newer methods (This fixes VS), but understand that if this code is used on a PC that does not have the compatible MSHTML / IE version then it will crash. (Same as the Office PIA and if you call for example an office 2013 method that does not exist on an Office 2010 installation.).
In my question I have linked to what are probably seen as the more correct answers to this issue.
If someone is looking for a quick and dirty solution then use late binding. I will explain specifically in my case what this means.
Dim div as HTMLDivElement
'make div something
div.getElementsByClassName 'this was not working!!!
This would not compile as the reference that Visual Studio is using is an old version.
So instead of follow the above because I only needed this a couple of times I changed the code to this.
Dim div as Object
'make div something
div.getElementsByClassName
Now Visual Studio will not have a problem with it. The problem you do face is that the final end user must have at lease a version of MSHTML (which is installed with Internet Explorer) that has this method or higher.
I hope this helps people who are still trying to work out what PIA's are and how they work in Visual Studio and MS environments.