Referencing a library written in a version above .net 4.8 in a Wisej application

0
0

I have a library written in .NET 6 and I need an application written in Wisej to reference it. But this is not possible because Wisej references .net 4.8. Is there a way around this problem?

  • You must to post comments
0
0

Hi Julie!!
Thanks for your answer!
To illustrate, I attached to the example you sent me, a library, that I created, and referenced in the Wisej project. The Wisej project runtime takes place in the net4.8 environment and I don’t know how to get around it. See in the attached example that the application does not recognize the net6.0 runtime.

I know I’m doing something wrong but I don’t know what it is, since in the example the EntityFramework 6.0 packages were attached to the 6.0 runtime and it worked, but with my library it doesn’t work.

Thanks!

 

Attachment
  • You must to post comments
0
0

Yes, it’s possible and a normal thing to do in Visual Studio to have multi targeting.

There are 3 common approached to multi targeting whether it is for .NET versions or OS targets:

1. Conditional compilation #if NETCOREAPP etc. You’ll find examples in most of Microsoft code on GitHub. You might also find the Microsoft Documentation on conditional compilation helpful.
2. Separating folders using conditional <ItemGroup> in the sdk format project
3. Separating files using conditional <ItemGroup> in the sdk format project
3a. Separating partial class files (most Microsoft projects use this approach with Socket.cs Socket.Windows.cs and Socket.Unix.cs for example, see Github)

See attached sample using EF Core.

We need net48 for the designer until Wisej.NET 4 where we will be able to have two separate designers, one for net48 and one for net core.

Attachment
  • SIDNEY DA SILVA ALVES
    It does not work. In the example, two Controllers classes were created to act in different processing spaces. However, the Controller class that references Microsoft.EntityFrameworkCore is NOT found by net48. The application compiles because the Controller class has been simulated in the application that runs on net48 and this class does nothing. The problem continues.
  • Luca (ITG)
    Of course it works. It’s not a Wisej issue. It’s basic multi targeting in .NET and sdk project format. Look for msbuild and sdk conditional attributes and multi targeting on msdn.if you attach a small complete project showing what you are trying to do we may be able help you further on that specific issue.
  • Sam Baraka
    I am having a similar challenge, I am referencing a class library done in .Net 5, can someone share a sample application kindly.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.