question

Pasc059-3466 avatar image
0 Votes"
Pasc059-3466 asked ·

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

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

dotnet-csharpc++windows-forms
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

lextm avatar image
0 Votes"
lextm answered ·
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Pasc059-3466 avatar image
0 Votes"
Pasc059-3466 answered ·

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

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Pasc059-3466 About migrating to .NET5, maybe this documentation can help you.


0 Votes 0 ·
Pasc059-3466 avatar image
0 Votes"
Pasc059-3466 answered ·

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

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.