Aspose.Cells.GridDesktop.GridDesktop Could not load ContextMenu in .Net Core 3.1

WPF project using .net core 3.1, and use the latest version of the nuget package.
But I can’t start the program after compiling, it throws the System.Windows.Markup.XamlParseException in InitializeComponent(), and the Inner Exception:

TypeLoadException: Could not load type 'System.Windows.Forms.ContextMenu' from assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

This is where the csproj file is edited:

    <UseWindowsForms>true</UseWindowsForms>

and the window xaml:

        xmlns:gridDesktop="clr-namespace:Aspose.Cells.GridDesktop;assembly=Aspose.Cells.GridDesktop"

                <WindowsFormsHost Loaded="FrameworkElement_OnLoaded" >
                    <WindowsFormsHost.Child>
                        <gridDesktop:GridDesktop x:Name="grid"/>
                    </WindowsFormsHost.Child>
                </WindowsFormsHost>

Is there a way to solve this, without changing the program’s framework?

@tp1415926535
GridDesktop is compiled in .net4 framework.
we haven’t try using it in .net core application.
we will try it and feedback to you

@tp1415926535
per my test.
the compiled process fail to import the dll in the .net core 3.1 project .
QQ图片20231013144116.png (55.7 KB)

can you share your project sample.

Here is my sample project.
AsposeCellsTest.zip (7.2 MB)

I noticed that the dependency package has warnings indicating that it is not supported by .net core.
But in Visual Studio errors list it reports the root cause, which is the obsolete control “System.Windows.Forms.ContextMenu”.

@tp1415926535
thanks for your sample.
We can see the errors .
The root cause is:
According to the official document that the “ContexrMenu” is not supported in the .Net Core 3.1 & .Net 5.0. (https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.contextmenustrip?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev16.query%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(System.Windows.Forms.ContextMenuStrip);k(DevLang-csharp)%26rd%3Dtrue&view=netcore-3.1), that ContextMenuStrip replaces ContextMenu.

In addition, the MainMenu, DataGrid, Menu, ToolBar are also removed as deprecated controls.

@tp1415926535
We will try to fix it.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-54389

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@tp1415926535
please try this hotfix .
GridDesktop.v23.10.5.netcore3.1.zip (5.5 MB)

we will publish official release soon.
if you find any issue ,please let us know.

Good job! I changed to referencing this dll and it works fine, provided that the nuget package for System.Windows.Extensions (Version=6.0.0) is additionally installed to ensure that System.Drawing.Common (Version=5.0.0.2) can be found.

@tp1415926535
Thank you for your feedback. I’m glad your issue has been resolved. If you have any questions, please feel free to contact us.

The issues you have found earlier (filed as CELLSNET-54389) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

@tp1415926535
we have published v23.11.0 version.
you can now get through nuget .

And the nuget version doesn’t have to look for additional System.Windows.Extensions, cheers!

ok, that is fine.If you have any questions, please feel free to contact us.