Migrate .Net 4.x C# Windows Forms Application + C++ DLLs to .NET 5

Pasc059 1 Reputation point
2020-12-11T16:20:04.303+00:00

Hello,

I'd like to migrate an application build with .Net Framework 4.7.2/Windows Forms/C# to .Net 5. From the documentation, i don't see so much problems to migrate the elements of this application that are written in C#. But this app also uses some DLLs written in Managed/non Managed C++. These DLLs uses some .net framework libraries like mscoree.lib, System.Drawing.dll,... Is it necessary to migrate these DLLs, and how? or do such DLLs can be used without changes in a .Net 5 project?

Regards

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,834 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,277 questions
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,537 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Lex Li (Microsoft) 4,742 Reputation points Microsoft Employee
    2020-12-12T06:42:31.08+00:00
    0 comments No comments

  2. Pasc059 1 Reputation point
    2020-12-14T16:36:09.067+00:00

    Hello,

    thaks for the link. The project "CppCliInterop" is simular to mine except that my vcxproj file does not contain a "TargetFrameworkVersion" property. Nevertheless, my DLL targets the ".NET Framework 4" (using ILSpy), but i dont't know how (perhaps this a default value when using "Visual Studio 2019 (v142)" PlatformToolset)?

    In the mean time, i tried to reference my DLL in a .Net 5 Winform application, and this works, which surprises me. So i wonder if it is really necessary to upgrade such DLL to .Net 5 as long as my application focuses Windows?

    regards


  3. Pasc059 1 Reputation point
    2020-12-16T19:09:33.347+00:00

    Hello,

    Thanks Kyle, but this link covers only Windows Forms. I followed this guide to upgrade my C# code; in fact, i had only few changes to do (like replacing usage of old controls DataGrid by DataGridView,...).
    I also tried to use another Dll which comes from third party supplier (and so i can not upgrade it to .net 5) and that targets .net 4 :
    [assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]

    and this seems to work.

    So it seems that it is not necessary to upgrade such DLL as long as the application is for Windows.

    Someone can confirm this?

    Regards

    0 comments No comments