Does C++/CLI support .NET Core 2.1?

Sandesh Sahane 1 Reputation point
2021-05-21T06:48:44.273+00:00

We have 32-bit C++/Cli library project which we have wrapped in .net project and it works fine when we target it to .net framework projects(4.5, 4,6,4.8 etc).

We are now trying to use this native library in .net core 2.1 project with PInvoke calls but its not working where as .net core 3.1 it does work. We have to change target framework on c++/cli library project to .net core 3.1 and then it works.
We could not see .net core 2.1 as target framework option on c++/cli library project.

So our question is does .net core 2.1 supports c++/cli projects with PInvoke calls? If not then anyway we need to use higher version of .net core.

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,453 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,101 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xingyu Zhao-MSFT 5,356 Reputation points
    2021-05-21T09:31:16.133+00:00

    Hi @Sandesh Sahane ,

    So our question is does .net core 2.1 supports c++/cli projects with PInvoke calls?

    No, .NET Core 2.1 does not support C++/CLI.
    C++/CLI have full IDE support for targeting .NET Core 3.1 and higher. See : The Future of C++/CLI and .NET Core 3
    So you need to install Visual Studio 2019. Another reference you may need: An Update on C++/CLI and .NET Core

    Hope them could be helpful.
    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments