Can I run an DotNet 6 dll from Framework 4 dll?

Nicolas Liebel 121 Reputation points
2021-11-17T21:59:34.197+00:00

I already have an WPF app with bunch of dll build on Framework 4. This app is calling some Addin Modules made in Framework 4, but I do need one now build on .Net6.
Is it OK or would it give me trouble? I don't really want to rebuilt the entire WPF application since only one dll module needs to be upgrading.
The code work when it is on my Dev but not on production and I did install Net 6 runtime.

Message: Value cannot be null.
Parameter name: type
Source: mscorlib
Trace: at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at BASIC.BASIC_MonitoringProcess.LoadModules()
Base: System.ArgumentNullException: Value cannot be null.
Parameter name: type
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at BASIC.BASIC_MonitoringProcess.LoadModules()

.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,117 questions
{count} votes

Accepted answer
  1. Nicolas Liebel 121 Reputation points
    2021-11-19T21:37:20.943+00:00

    Hi,
    I end it up creating that Addin in framework 4.8 which then work ok so far, need to go on production to validate this.
    I whish I could have upgraded the entire solution in .Net6 but way too many line of code at this point :-(

    Thanks for the help.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,036 Reputation points
    2021-11-18T15:45:20.717+00:00

    Change the net6 project to .netstandard 2.0

    0 comments No comments