DllImport in .NetCore RRS feed

  • Question

  • Hi,

    I have to port .netFramework code which has dllimport("kernel32.dll") to .NetCore(targeting ubuntu 14 and windows). Question is when we have dependency on such dlls (native to windows /any platform) how the ported code will work on other platforms? 

    Such dll dependencies need to be replaced by ubuntu specific in my case? then portability will break. 

    Any ideas how to address this, thanks in advance.

    Tuesday, August 8, 2017 10:27 AM

All replies

  • As far as I see, Maybe you need to check which system you are using, and then use:

    1) if……else if……to decide the logic whether these DLLIMPORT codes should be executed or not.

    2) Use conditional compile by #define……

    Notice that the reason why Microsoft publishes "Core" is that Microsoft wanna make .NET all over the world on the systems. So Many features ONLY for Windows are ignored or removed. And .NET Core seems less than the traditional .NET framework.

    ASP.NET Forum
    FreeRice Donate
    Issues to report

    Tuesday, August 8, 2017 10:34 AM
  • There is no reason to have platform based dependencies in .NETCore. Implement the same using native libraries.
    Monday, June 1, 2020 1:36 PM