Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Forms GUI beside .NET Core libraries Is it possible? [duplicate]

Tags:

c#

.net

I have some libraries that was written in .NET Core

Can I use these libraries in Windows Form Application ?

Can I reference them to my Win Forms or WPF ?

In general Can I use .NET Framework beside .NET Core ?

because I want to migrate to .NET Core but I need GUI for my Projects too and currently .NET Core does not support it

@JonSkeet ask me Do you test it ? Yes I test a very simple dotNETCore with my WinForm GUI

in dotNET Core

public class Person
{
    [EmailAddress]
    public string Name { get; set; }
}

public static class TestCore
{
    public static string Get()
    {
        var type = typeof(Person).GetProperty("Name");
        var attr = type.Attributes;
        return attr.ToString();
    }
}

I use reflection because Reflection namespace changed in it

so I call Get() method in my GUI with button click. but show me an error

Additional information: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I added that library into my winform project and booooooom !!! Now my Winform project does not work !!!

enter image description here

Warning RCS1060 Consider declaring each type in separate file.  dotNETCore..NETStandard,Version=v1.5    \visual studio 2015\Projects\dotNETCore\src\dotNETCore\Person.cs

Error   CS0433  The type 'EditorBrowsableAttribute' exists in both 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'  WindowsFormsApplication1    \visual studio 2015\Projects\dotNETCore\WindowsFormsApplication1\Properties\Resources.Designer.cs

seems something is wrong but I hope that I can use .NET Framework and dotNET Core together because we dont have any GUI solution yet !

I hope MICROSOFT work on .NET Core version of WPF.

like image 678
HamedFathi Avatar asked Jan 28 '26 22:01

HamedFathi


1 Answers

Microsoft have started producing a Winforms addon for Net Core https://github.com/dotnet/winforms ..

The notable problems are that Net Core Winforms doesnt have designer support (yet) so you might have to hold off on the full move to Net Core for now!

like image 52
Robert Perry Avatar answered Jan 31 '26 10:01

Robert Perry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!