Problem with .NET 2.0 and MSHTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hans Merkl

    Problem with .NET 2.0 and MSHTML

    Hi,

    I have written an pap with .NET 2.0 and c# that uses MSHTML. It works fine
    on my development machine but on machines I deploy it to I get the
    following exception when ever I call MSHTML.

    "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
    Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
    dependencies. The system cannot find the file specified."

    The machine has .NET 2 installed and all the latest patches.

    It seems I am using a newer MSHTML version on my development machine. I
    wouldn't mind using an older version but I don't know where to get a
    typelib for older MSHTML versions.

    Has anybody else seen this problem and knows a workaround other than not
    using MSHTML?

    Thanks

    Hans Merkl

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Problem with .NET 2.0 and MSHTML

    Hans,

    If you are using MSHTML, then you might want to consider using the
    classes in the System.Windows. Forms namespace which are HTML DOM elements
    (HtmlDocument, HtmlElement, and a host of other classes). They should give
    you what you need, as well as eliminate that issue with conflicting MSHTML
    versions.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Hans Merkl" <rhmware@newsgr oups.nospam> wrote in message
    news:4c1x9orf3v rk.1p40nafjk1d7 q$.dlg@40tude.n et...[color=blue]
    > Hi,
    >
    > I have written an pap with .NET 2.0 and c# that uses MSHTML. It works fine
    > on my development machine but on machines I deploy it to I get the
    > following exception when ever I call MSHTML.
    >
    > "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
    > Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
    > dependencies. The system cannot find the file specified."
    >
    > The machine has .NET 2 installed and all the latest patches.
    >
    > It seems I am using a newer MSHTML version on my development machine. I
    > wouldn't mind using an older version but I don't know where to get a
    > typelib for older MSHTML versions.
    >
    > Has anybody else seen this problem and knows a workaround other than not
    > using MSHTML?
    >
    > Thanks
    >
    > Hans Merkl
    >[/color]


    Comment

    • Max

      #3
      Re: Problem with .NET 2.0 and MSHTML

      That's what I ended up doing. But these classes are quite limited.

      For example: Do you know how to create a HtmlDocument object from a file
      without using a WebBrowser control? I haven't figured that out.

      MSHTML is much more powerful and I know it already.

      On Fri, 4 Nov 2005 10:40:46 -0500, Nicholas Paldino [.NET/C# MVP] wrote:
      [color=blue]
      > Hans,
      >
      > If you are using MSHTML, then you might want to consider using the
      > classes in the System.Windows. Forms namespace which are HTML DOM elements
      > (HtmlDocument, HtmlElement, and a host of other classes). They should give
      > you what you need, as well as eliminate that issue with conflicting MSHTML
      > versions.
      >
      > Hope this helps.[/color]

      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: Problem with .NET 2.0 and MSHTML

        Max,

        You are right, it is a little limited. In order to do that, you would
        have to get the object from the DomDocument property, and cast that to the
        IPersistFile interface (you can use the one in the
        System.Runtime. InteropServices .ComTypes namespace). Then, you can call the
        Load method on the interface, and it should load the contents from disk.

        Hope this helps.


        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "Max" <eurodude2011@y ahoo.com> wrote in message
        news:3wgk72xkct rz$.re97vvjtrmr t.dlg@40tude.ne t...[color=blue]
        > That's what I ended up doing. But these classes are quite limited.
        >
        > For example: Do you know how to create a HtmlDocument object from a file
        > without using a WebBrowser control? I haven't figured that out.
        >
        > MSHTML is much more powerful and I know it already.
        >
        > On Fri, 4 Nov 2005 10:40:46 -0500, Nicholas Paldino [.NET/C# MVP] wrote:
        >[color=green]
        >> Hans,
        >>
        >> If you are using MSHTML, then you might want to consider using the
        >> classes in the System.Windows. Forms namespace which are HTML DOM elements
        >> (HtmlDocument, HtmlElement, and a host of other classes). They should
        >> give
        >> you what you need, as well as eliminate that issue with conflicting
        >> MSHTML
        >> versions.
        >>
        >> Hope this helps.[/color][/color]


        Comment

        • Max

          #5
          Re: Problem with .NET 2.0 and MSHTML

          That will cause me to use MSHTML and I will run into my problem again :-)

          There must be a solution for this. By default VS.NET references an MSHTML
          interop from the GAC. I just need to reference another interop assembly.

          On Fri, 4 Nov 2005 12:16:01 -0500, Nicholas Paldino [.NET/C# MVP] wrote:
          [color=blue]
          > Max,
          >
          > You are right, it is a little limited. In order to do that, you would
          > have to get the object from the DomDocument property, and cast that to the
          > IPersistFile interface (you can use the one in the
          > System.Runtime. InteropServices .ComTypes namespace). Then, you can call the
          > Load method on the interface, and it should load the contents from disk.
          >
          > Hope this helps.[/color]

          Comment

          • Willy Denoyette [MVP]

            #6
            Re: Problem with .NET 2.0 and MSHTML


            "Hans Merkl" <rhmware@newsgr oups.nospam> wrote in message
            news:4c1x9orf3v rk.1p40nafjk1d7 q$.dlg@40tude.n et...[color=blue]
            > Hi,
            >
            > I have written an pap with .NET 2.0 and c# that uses MSHTML. It works fine
            > on my development machine but on machines I deploy it to I get the
            > following exception when ever I call MSHTML.
            >
            > "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
            > Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
            > dependencies. The system cannot find the file specified."
            >
            > The machine has .NET 2 installed and all the latest patches.
            >
            > It seems I am using a newer MSHTML version on my development machine. I
            > wouldn't mind using an older version but I don't know where to get a
            > typelib for older MSHTML versions.
            >
            > Has anybody else seen this problem and knows a workaround other than not
            > using MSHTML?
            >
            > Thanks
            >
            > Hans Merkl
            >[/color]

            'Microsoft.msht ml, Version=7.0.330 0.0,......
            is a v1.x assembly, I could be wrong, but I don't think it's part of the
            v2.0 Framework. Are you sure it's present in the GAC?


            Willy.




            Comment

            • Max

              #7
              Re: Problem with .NET 2.0 and MSHTML

              On Fri, 4 Nov 2005 20:17:24 +0100, Willy Denoyette [MVP] wrote:
              [color=blue]
              > "Hans Merkl" <rhmware@newsgr oups.nospam> wrote in message
              > news:4c1x9orf3v rk.1p40nafjk1d7 q$.dlg@40tude.n et...[color=green]
              >> Hi,
              >>
              >> I have written an pap with .NET 2.0 and c# that uses MSHTML. It works fine
              >> on my development machine but on machines I deploy it to I get the
              >> following exception when ever I call MSHTML.
              >>
              >> "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
              >> Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
              >> dependencies. The system cannot find the file specified."
              >>[/color][/color]
              [color=blue][color=green]
              >> The machine has .NET 2 installed and all the latest patches.
              >>
              >> It seems I am using a newer MSHTML version on my development machine. I
              >> wouldn't mind using an older version but I don't know where to get a
              >> typelib for older MSHTML versions.
              >>
              >> Has anybody else seen this problem and knows a workaround other than not
              >> using MSHTML?
              >>
              >> Thanks
              >>
              >> Hans Merkl
              >>[/color]
              >
              > 'Microsoft.msht ml, Version=7.0.330 0.0,......
              > is a v1.x assembly, I could be wrong, but I don't think it's part of the
              > v2.0 Framework. Are you sure it's present in the GAC?
              >
              >
              > Willy.[/color]


              When I look at the properties of the reference in my project I this is the
              file location:
              C:\WINDOWS\asse mbly\GAC\Micros oft.mshtml\7.0. 3300.0__b03f5f7 f11d50a3a\Micro soft.mshtml.dll

              I had the beta versions of the framework installed (uninsitalled them
              before I installed the final version though). Maybe that's the problem?

              Comment

              • Willy Denoyette [MVP]

                #8
                Re: Problem with .NET 2.0 and MSHTML

                What I mean is that it should be present in the GAC on the target machine.
                If not, you should deploy it with your application, or your should install
                the redistributable of the primary interop assemblies (see Program
                files\Common Files\Merge modules).

                Willy.



                "Max" <eurodude2011@y ahoo.com> wrote in message
                news:ycf31o4neg 4a.1399h2bjztpt z.dlg@40tude.ne t...[color=blue]
                > On Fri, 4 Nov 2005 20:17:24 +0100, Willy Denoyette [MVP] wrote:
                >[color=green]
                >> "Hans Merkl" <rhmware@newsgr oups.nospam> wrote in message
                >> news:4c1x9orf3v rk.1p40nafjk1d7 q$.dlg@40tude.n et...[color=darkred]
                >>> Hi,
                >>>
                >>> I have written an pap with .NET 2.0 and c# that uses MSHTML. It works
                >>> fine
                >>> on my development machine but on machines I deploy it to I get the
                >>> following exception when ever I call MSHTML.
                >>>
                >>> "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
                >>> Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
                >>> dependencies. The system cannot find the file specified."
                >>>[/color][/color]
                >[color=green][color=darkred]
                >>> The machine has .NET 2 installed and all the latest patches.
                >>>
                >>> It seems I am using a newer MSHTML version on my development machine. I
                >>> wouldn't mind using an older version but I don't know where to get a
                >>> typelib for older MSHTML versions.
                >>>
                >>> Has anybody else seen this problem and knows a workaround other than not
                >>> using MSHTML?
                >>>
                >>> Thanks
                >>>
                >>> Hans Merkl
                >>>[/color]
                >>
                >> 'Microsoft.msht ml, Version=7.0.330 0.0,......
                >> is a v1.x assembly, I could be wrong, but I don't think it's part of the
                >> v2.0 Framework. Are you sure it's present in the GAC?
                >>
                >>
                >> Willy.[/color]
                >
                >
                > When I look at the properties of the reference in my project I this is the
                > file location:
                > C:\WINDOWS\asse mbly\GAC\Micros oft.mshtml\7.0. 3300.0__b03f5f7 f11d50a3a\Micro soft.mshtml.dll
                >
                > I had the beta versions of the framework installed (uninsitalled them
                > before I installed the final version though). Maybe that's the problem?[/color]


                Comment

                • Nicholas Paldino [.NET/C# MVP]

                  #9
                  Re: Problem with .NET 2.0 and MSHTML

                  Max,

                  I don't see how it would. The classes in the System.Windows. Forms
                  namespace use MSHTML as well under the covers, so it's a matter of your
                  interop assembly being incorrect.


                  --
                  - Nicholas Paldino [.NET/C# MVP]
                  - mvp@spam.guard. caspershouse.co m

                  "Max" <eurodude2011@y ahoo.com> wrote in message
                  news:d1f9c1awia iw$.w6q68bdls0e q$.dlg@40tude.n et...[color=blue]
                  > That will cause me to use MSHTML and I will run into my problem again :-)
                  >
                  > There must be a solution for this. By default VS.NET references an MSHTML
                  > interop from the GAC. I just need to reference another interop assembly.
                  >
                  > On Fri, 4 Nov 2005 12:16:01 -0500, Nicholas Paldino [.NET/C# MVP] wrote:
                  >[color=green]
                  >> Max,
                  >>
                  >> You are right, it is a little limited. In order to do that, you
                  >> would
                  >> have to get the object from the DomDocument property, and cast that to
                  >> the
                  >> IPersistFile interface (you can use the one in the
                  >> System.Runtime. InteropServices .ComTypes namespace). Then, you can call
                  >> the
                  >> Load method on the interface, and it should load the contents from disk.
                  >>
                  >> Hope this helps.[/color][/color]


                  Comment

                  • Max

                    #10
                    Re: Problem with .NET 2.0 and MSHTML

                    You are right. I installed vs_piaredist.ex e from the directory "Merge
                    Modules" and now it works. I guess the name indicates I can redistribute it
                    wth my app.

                    I am getting too old for this.....

                    On Fri, 4 Nov 2005 21:05:36 +0100, Willy Denoyette [MVP] wrote:
                    [color=blue]
                    > What I mean is that it should be present in the GAC on the target machine.
                    > If not, you should deploy it with your application, or your should install
                    > the redistributable of the primary interop assemblies (see Program
                    > files\Common Files\Merge modules).
                    >
                    > Willy.
                    >
                    >
                    >
                    > "Max" <eurodude2011@y ahoo.com> wrote in message
                    > news:ycf31o4neg 4a.1399h2bjztpt z.dlg@40tude.ne t...[color=green]
                    >> On Fri, 4 Nov 2005 20:17:24 +0100, Willy Denoyette [MVP] wrote:
                    >>[color=darkred]
                    >>> "Hans Merkl" <rhmware@newsgr oups.nospam> wrote in message
                    >>> news:4c1x9orf3v rk.1p40nafjk1d7 q$.dlg@40tude.n et...
                    >>>> Hi,
                    >>>>
                    >>>> I have written an pap with .NET 2.0 and c# that uses MSHTML. It works
                    >>>> fine
                    >>>> on my development machine but on machines I deploy it to I get the
                    >>>> following exception when ever I call MSHTML.
                    >>>>
                    >>>> "Could not load file or assembly 'Microsoft.msht ml, Version=7.0.330 0.0,
                    >>>> Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a' or one of its
                    >>>> dependencies. The system cannot find the file specified."
                    >>>>[/color]
                    >>[color=darkred]
                    >>>> The machine has .NET 2 installed and all the latest patches.
                    >>>>
                    >>>> It seems I am using a newer MSHTML version on my development machine. I
                    >>>> wouldn't mind using an older version but I don't know where to get a
                    >>>> typelib for older MSHTML versions.
                    >>>>
                    >>>> Has anybody else seen this problem and knows a workaround other than not
                    >>>> using MSHTML?
                    >>>>
                    >>>> Thanks
                    >>>>
                    >>>> Hans Merkl
                    >>>>
                    >>>
                    >>> 'Microsoft.msht ml, Version=7.0.330 0.0,......
                    >>> is a v1.x assembly, I could be wrong, but I don't think it's part of the
                    >>> v2.0 Framework. Are you sure it's present in the GAC?
                    >>>
                    >>>
                    >>> Willy.[/color]
                    >>
                    >>
                    >> When I look at the properties of the reference in my project I this is the
                    >> file location:
                    >> C:\WINDOWS\asse mbly\GAC\Micros oft.mshtml\7.0. 3300.0__b03f5f7 f11d50a3a\Micro soft.mshtml.dll
                    >>
                    >> I had the beta versions of the framework installed (uninsitalled them
                    >> before I installed the final version though). Maybe that's the problem?[/color][/color]

                    Comment

                    • Max

                      #11
                      Re: Problem with .NET 2.0 and MSHTML

                      On Fri, 4 Nov 2005 15:08:18 -0500, Nicholas Paldino [.NET/C# MVP] wrote:
                      [color=blue]
                      > Max,
                      >
                      > I don't see how it would. The classes in the System.Windows. Forms
                      > namespace use MSHTML as well under the covers, so it's a matter of your
                      > interop assembly being incorrect.[/color]

                      Please see my response to Willy. Running vs_piaredist.ex e solved the
                      problem.

                      Comment

                      Working...