CoreWindowsWrapper 1.0.47

There is a newer version of this package available.
See the version list below for details.
dotnet add package CoreWindowsWrapper --version 1.0.47
NuGet\Install-Package CoreWindowsWrapper -Version 1.0.47
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreWindowsWrapper" Version="1.0.47" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CoreWindowsWrapper --version 1.0.47
#r "nuget: CoreWindowsWrapper, 1.0.47"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CoreWindowsWrapper as a Cake Addin
#addin nuget:?package=CoreWindowsWrapper&version=1.0.47

// Install CoreWindowsWrapper as a Cake Tool
#tool nuget:?package=CoreWindowsWrapper&version=1.0.47

CoreWindowsWrapper

Native Windows Wrapper for .NET-Core and .Framework

CoreWindowsWrapper is a DLL you can use to create Core Applications showing Dialogs without using System.Windows.Forms. The Project uses the Windows - API to create Native Windows. I personally use this DLL to create Copy-Deploy-Setups.

This is a Visual Stuido 2019 Preview Project using NETCore 3.0-preiew. With NETCore 3.0 you can create Windows-Applications.

If You want to use this with NETCore 2.X you can Publish the native app. Go into the Publish-Folder and modify the EXE SUBSYSTEM. This changes the Comsole-Application to a Windows-Application:)

editbin.exe ConsleCaller.exe /SUBSYSTEM:WINDOWS

If you want to enable vusual Styles you can use MT.EXE

mt.exe -manifest app.manifest -outputresource:ConsoleCaller.exe;#1

Please do not use core 2.x anymore. Microsoft discontinues support for the version. Look at the following page: https://dotnet.microsoft.com/download/dotnet-core

currently .NET Core 3.1 is recommanded

.Net 5.0 will be released soon!

Procedure from .Core 3.1:

  1. Create a project from the Type Console (Core).
  2. Change the output type from Console to Windows application in the project properties.
Application with Styling enabled.

If the application contains the Manifest it looks like this.

Application with Style

Application with Styling disabled.

If you do not use MT.exe or do not include app.manifest in your Project. The application looks like this.

Application with Style

Create a Native Window

Create a new Class derive from NativeWindow

//Native Window
public class Window1:NativeWindow
{
	//Add your Controls
	//in this example a Button
	private NativeButton _Button;
	
	//Override InitControls Function
	protected override void InitControls()
	{
		//Set the properties of the Form.
		this.Text = "Dies ist meine Anwnedung";//Caption of the Window.
		this.Name = "Window1";
		this.Left = 100;
		this.Top = 100;
		this.Width = 600;
		this.Height = 400;
		
		//Create the Button
		this._Button = new NativeButton
		{
			Left = 10,
			Top = 10,
			Width = 100,
			Height = 30,
			Text = "Test",//Caption of the Button
			Name = "bnTest",
			Font = new Font(){Name="Arial",Size=14} //set the Font of the Button
		};	
		//Add Eventhandler
		this._Button.Clicked += button_OnClicked;
		
		//Add the Button to the Window.
		this.Controls.Add(this._Button);
	}
	//Eventhandler for the Button
	private void button_OnClicked(object sender, EventArgs e)
	{
		//Show a Messagebox.
		MessageBox.Show("Button Clicked!");
	}
}

For more Details have a look at the Project ConsoleCaller.

Initialize the Application

To initilize the Application you have to create 2 Lines of Code in the Main-Function. This is necessary because of Threading and Windows Messaging.

using CoreWindowsWrapper;

namespace ConsleCaller
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the Window
            Window1 nw = new Window1();
            //Run the Application
            NativeApp.Run(nw);
        }
    }
}

Example Videos:

  1. How to crate a control with CoreWindowsWrapper
  2. Visual Styles

Mac-OS comming soon:

Take a look at the preview


I hope this helps in many Projects.

Dipl.-Ing.(FH) Guido Agnesmeyer
June 2020
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CoreWindowsWrapper:

Package Downloads
Diga.NativeControls.WebBrowser

Diga.NativeControls.WebBrowser.Core

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.8.20-prerelease 44 4/25/2024
2.0.8.18-prerelease 59 4/10/2024
2.0.8.15-prerelease 72 3/14/2024
2.0.8.1-prerelease 85 2/23/2024
2.0.8-prerelease 82 2/22/2024
2.0.7 373 2/20/2024
2.0.6 84 2/20/2024
2.0.5 76 2/19/2024
2.0.4 655 10/4/2023
2.0.3 1,142 2/25/2022
2.0.2 3,842 12/6/2021
2.0.1-preview 500 10/21/2021
1.0.47 855 3/4/2021
1.0.46 1,197 8/7/2020
1.0.45 593 7/13/2020
1.0.44 586 7/2/2020
1.0.43 437 6/19/2020
1.0.42 443 6/18/2020
1.0.41 576 6/16/2020
1.0.3.3 461 1/29/2020
1.0.3.1 561 6/14/2019
1.0.2.2 398 2/20/2019
1.0.2.1 359 2/13/2019
1.0.2 852 2/10/2019
1.0.0 641 1/26/2019

BugFixes BeforeCreateEventArgs confilicts with other EvetnArgs: renamed to BeforeWindowCreateEventArgs