Search Unity

Resolved Fail to Load .Net PresentationCore.dll

Discussion in 'Formats & External Tools' started by AudrasC, Jul 8, 2020.

  1. AudrasC

    AudrasC

    Joined:
    Feb 19, 2016
    Posts:
    19
    Hello

    What I want to do:
    I'm taking a screenshot in our application and print the image using a custom printer. Before printing I need to apply an ICC profile to the image. It is possible to do that by converting the image(Bitmap) into a BitmapSource and apply the Icc profile using .Net. The BitmapSource class is located in the PresentationCore.dll which Unity does not have. I'm trying to import the dll by putting it (and all other references) in the plugins folder but Unity fails to load the dll.
    [Loading assembly failed: "Assets/Plugins/PresentationCore.dll"]

    What I tried:
    - Put the dll into Assets/Plugins/
    - I have also try to put it in the crc.rsp but doesn't change anything.
    - Tried to create another .net dll using a reference to PresentationCore.dll but it says that it missed references even if I put everything in the assets/Plugins
    - I tried to use the dll from different version of .Net (4.6, 4.7.1, 4.7.2)

    I took the dll from
    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2

    I was able to import System.Drawing.dll but have problems with the PresentationCore.dll.
    Does anyone have an idea how to import it or other way that would allow me to use the PresentationCore.dll ?
    Thank you

    PS: Using Unity2019.3.4.
     
    Last edited: Jul 8, 2020
  2. AudrasC

    AudrasC

    Joined:
    Feb 19, 2016
    Posts:
    19
    I believe that it is not possible to use PresentationCore.dll as it is part of the WPF and mono does not implement WPF.

    For those interested, I used another library called Magick.Net.