Results 1 to 8 of 8

Thread: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2021
    Posts
    31

    Question Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    I have an application which use Rich Text Box on .NET Framework 4.0 (the code compiles fine with VS2010 as well as VS2019).

    I have used the .NET 5 Rich Text Box and noticed some improvements.

    Is it possible to use .NET 5 Rich Text Box with .NET Framework 4.0 Windows Forms application?

    If yes, how?

    Thanx.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    Of course it isn't possible. For one thing, .NET 5.0 is .NET Core, not .NET Framework. Even if they were compatible though, a .NET 4.0 application is .NET 4.0, not .NET 5.0, so it only has access to .NET 4.0 features and functionality. If it had access to .NET 5.0 features and functionality then it would be .NET 5.0.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jan 2021
    Posts
    31

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    Ah OK, I thought somehow I could use a .NET Core DLL in .NET Framework

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    Quote Originally Posted by mobi12 View Post
    Ah OK, I thought somehow I could use a .NET Core DLL in .NET Framework
    They work fairly differently. The .NET Framework is installed on the user's system and that contains all the standard types that your app uses. With .NET Core, the standard types are deployed with your application and the WinForms types are a package that you can't even reference separately.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2021
    Posts
    31

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    Yes noticed that. What was a 1 MB EXE in .NET Framework, after publishing in .NET Core it became 140 MB even after trimming

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    It's not something I've tried to do but it is possible to install .NET Core once on a system and for applications to share libraries, just like with .NET Framework.

    https://docs.microsoft.com/en-us/dot...-vs?tabs=vs156

  7. #7
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    Quote Originally Posted by mobi12 View Post
    Yes noticed that. What was a 1 MB EXE in .NET Framework, after publishing in .NET Core it became 140 MB even after trimming
    This is simply not true. If you edit your project, you can set if you want to publish _all_ libraries, so destination system may not have .NET 5/Core runtime installed and still run the project, or not.

    These are the settings in the project:
    Code:
    <PublishReadyToRun>true</PublishReadyToRun>
    <PublishTrimmed>false</PublishTrimmed>
    When PublishReadyToRun is false, then the result executable is few kilobytes.

    When project is not published "ready to run" with all dependencies, then it requires .NET Core runtime to be installed - exactly like .NET Framework on old Windows versions (XP, 2003).

  8. #8
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Using .NET 5 Rich Text Box with .NET 4 Windows Forms application

    .NET 5/Core and .NET Framework can share libraries but I doubt this will work for duplicate libraries required for WinForms. Check .NET Standard about compatibility between different "frameworks" and "cores".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width