Skip to content

Latest commit

 

History

History
132 lines (103 loc) · 9.38 KB

readme.md

File metadata and controls

132 lines (103 loc) · 9.38 KB

Icon dotnet-chromium

Version Downloads License Build

Chromium for .NET 6+.

This project allows running a portable embedded version of Chromium from either a .NET CLI tool or a regular .NET application without having to install it.

This can help automate a browser as part of your regular app normal behavior, such as using Microsoft.Playwright.

Usage

The project provides two main ways to consume it:

  • As a dotnet global tool
  • As a regular nuget package library reference.

dotnet global tool

Install with:

dotnet tool install -g dotnet-chromium

Run with:

chromium [url] [switches]

The url is optional, and causes the browser to navigate immediately to that URL on open.

The switches are optional, and are passed directly to Chromium. For example, you'd pass -headless to run the browser headless. See the list of chromium switches for more information.

nuget package library reference

Install-Package chromium
if (Chromium.Path != null)
    Console.WriteLine($"Found Chromium for current platform at {Chromium.Path}");
else
    Console.WriteLine($"Current runtime {System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier} is not supported.");

This will provide the runtime lookup of the native binaries, but will not provide the binaries themselves. In other words, the chromium package is not a metapackage. Since NuGet does not provide a built-in mechanism to conditionally reference specific packages depending on the current runtime platform or library target's RuntimeIdentifier(s), a metapackage is not practical since it would cause a restore of all platforms, which only bloats download and install size unnecessarily. If you know what platforms your app will run on, you can reference the relevant ones manually by adding package references to chromium.[RID] as necessary:

Linux-x64 Win-x64 Win-x86

Releasing

Create a new release versioned as v[YYYY].[M].[D] and the bundled binaries will be the snapshots of the day the release build runs, fetched from:

Sponsors

Clarius Org Kirill Osenkov MFB Technologies, Inc. Stephen Shaw Torutek DRIVE.NET, Inc. Ashley Medway Keith Pickford Thomas Bolon Kori Francis Toni Wenzel Giorgi Dalakishvili Mike James Dan Siegel Reuben Swartz Jacob Foshee Eric Johnson Norman Mackay Certify The Web Ix Technologies B.V. David JENNI Jonathan Oleg Kyrylchuk Charley Wu Jakob Tikjøb Andersen Seann Alexander Tino Hager Mark Seemann Angelo Belchior Ken Bonny Simon Cropp agileworks-eu sorahex Zheyu Shen Vezel Georg Jung

Sponsor this project  

Learn more about GitHub Sponsors