This is a migrated thread and some comments may be shown as answers.

Could not load file or assembly microsoft.mshtml in Telerik Reporting

6 Answers 144 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Abdechafi
Top achievements
Rank 1
Veteran
Abdechafi asked on 17 Feb 2021, 07:55 AM

Good morning,

I'm using Telerik Reporting and after opening the trdp file in order to modify it , I select a bloc section to edit it , I got this error : ( see error1.png)

I saw many solution on StackOverflow and I have already added Microsoft.mshtml in Visual Studio 2019 and Copy local option is set to true but there is no change and I'm still getting this exception .

 

How can I solve this error?

How can I add a report to my WPF application?


 

6 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 19 Feb 2021, 05:17 PM

Hi Abdechafi,

Thank you for providing the screenshots of the error. From what I can see, it appears that you are using an older version of Telerik Reporting. If this is the case, I recommend upgrading to the latest version which can be acquired from your Telerik Account page. 

Additionally, we provide thorough documentation for using the WPF Report Viewer. The best approach to add the WPF Report Viewer to an existing WPF application is to use the WPF Report Viewer Item Template in Visual Studio which will perform the necessary steps to add the report viewer.

Alternatively, it can be done manually as well. Note that according to the documentation, the Microsoft.mshtml assembly isn't required in the latest version which is why I think an upgrade is necessary.

If an upgrade is not possible, can you let me konw which Telerik Reporting and .NET Framework versions you are targeting?

In the meantime, please let me know if you need any additional information. Thank you for using the Telerik Report Forums.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Abdechafi
Top achievements
Rank 1
Veteran
answered on 22 Feb 2021, 08:31 AM

Good morning Eric ,

Thank you for your reply , from a while ago , I have started using a sample report and it works , the problem appears only when I choose a custom report from Telerik Reporting .

- The Telerik Reporting version is : 14.2.20.1021

- .Net Framework version is : 4.8.

- Visual Studio Professional 2019.

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 22 Feb 2021, 08:18 PM

Hi Abdechafi,

Thank you for the version information. However, I am still unclear about the scenario. As a result, I have attached a working sample that can be used as a baseline for comparison.

To run the sample locally, ensure the Telerik NuGet Feed is configured in Visual Studio. The sample embeds a sample report and displays it in the WPF Report Viewer.

If the issues persists, can you attach the problematic report/WPF application to this thread for review?

In the meantime, please let me know if you need any additional information. Thank you.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Abdechafi
Top achievements
Rank 1
Veteran
answered on 23 Feb 2021, 07:56 AM

Hello Eric,

Thank your for your answer, I will describe the scenario.

1/ I opened the VS 2019

2/ I clicked on new item and I added Telerik Reporting as mentioned in the image ( reportviewer.png )

3/ I clicked on add and I did Next : (reportviewer1.png ) 

4/ I chose Embedded and I clicked on Next again.

5/ I chose sampleReport ( reportviewer2.png ) and I clicked on Next.

6/ I checked the enable accessibility checkbox and I clicked on finish. ( reportviewer3.png)

7/ I did a double click on the file created called " samplereport.trdp" ( reportviewer5.png )

8/ After opening I got this design , when I click in the medium of the report ( reportviewer7.png)

9/ I got this error , see ( reportviewer8.png )

 

I hope that you have understand the scenario now

Note : I'm sorry about the name of the report file ( it's called sampleReport ) but what I have mean in the previous question is that I have problems only with sampleReport , not with BlankReport .

0
Accepted
Eric R | Senior Technical Support Engineer
Telerik team
answered on 23 Feb 2021, 05:08 PM

HI Abdechafi,

Thank you for the additional images. I believe that I understand the scenario now. From what I can see, the machine that has Telerik Reporting installed doesn't include microsoft.mshtml in the Global Assembly Cache (GAC). This leaves a couple of troubleshooting steps to perform. Let me go over them below. 

Troubleshooting Steps

Step 1 - The first steps is to copy the microsoft.mshtml.dll assembly to the designer folder as shown in the following screenshot.

After the assembly is moved over, try opening the SampleReport.trdp file and selecting the HtmlTextBox like before. 

Step 2 - If the error still appears, try referencing it like the following code snippet from the Telerik.ReportDesigner.exe.config or Telerik.ReportDesigner.x86.exe.config configuration files.

<!-- Add assembly references -->
<Telerik.Reporting>
  <AssemblyReferences>
    <add name="Microsoft.mshtml" version="7.0.3300.0" />
  </AssemblyReferences>
</Telerik.Reporting>

After adding the reference, try opening the SampleReport.trdp file and selecting the HtmlTextBox as before.

Step 3 - If the error still appears, then the final option is to install the Microsoft.mshtml assembly in the GAC. To do this use the gacutil.exe included with the Developer Commnad Prompt for VS 2019. See the following screenshot for a visual reference. 

Instructions for Installing the assembly in the GAC

  • With the Developer Command Prompt open, execute gacutil /l microsoft.mshtml and it should display Number of items = 0.
  • Then change directory to the folder where the microsoft.mshtml.dll exists. Once there, execute gacutil /i microsoft.mshml.dll.
  • After the previous command, execute gacutil /l microsoft.mshtml and it should appear as below.

For reference to these instructions, see How to: Install an assembly into the global assembly cache from the Microsoft Docs.

Once the microsoft.mshtml assembly has been added to the GAC, open the SampleReport.trdp and select the HtmlTextBox as before.

Wrapping Up

Unfortunately, I don't believe that this is something caused by Telerik. We have had a few users report some Windows Server variants that do not contain the microsoft.mshtml assembly.

Please give the above troubleshooting steps a try and let me know the results. Thank you and I look forward to your reply.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Abdechafi
Top achievements
Rank 1
Veteran
answered on 24 Feb 2021, 07:41 AM

Good morning Erik ,

Thank you, the first solution solved the error ( copy the dll file to Report Designer folder ) and I can now modify the HtmlTextBox section.

Tags
General Discussions
Asked by
Abdechafi
Top achievements
Rank 1
Veteran
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Abdechafi
Top achievements
Rank 1
Veteran
Share this question
or