locked
Using System.Windows.Media in a Blazor project RRS feed

  • Question

  • User952791441 posted

    Anytime I try and instantiate a class that uses System.Windows.Media I get the following error:

    Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer: Warning: Unhandled exception rendering component: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
    
    System.IO.FileNotFoundException: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
    File name: 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
       at Report.Pages.MyReport.OnInitialized()
       at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

    Is there a way around this? I'd like to continue using my class library without changing too much.

    Tuesday, September 29, 2020 2:39 PM

Answers

  • User475983607 posted

    The System.Windows.Media is a WPF API.  Blazor runs in the browser not a WPF form.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 29, 2020 2:56 PM

All replies

  • User475983607 posted

    The System.Windows.Media is a WPF API.  Blazor runs in the browser not a WPF form.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 29, 2020 2:56 PM
  • User952791441 posted

    Makes sense. I went through my library and changed everything over to System.Drawing and created a converter for my WPF projects. Seems to work now. Thanks.

    Tuesday, September 29, 2020 3:23 PM