tareqimbasher / NetPad

A cross-platform C# editor and playground.
MIT License
1.09k stars 56 forks source link
aurelia cross-platform csharp database desktop dotnet editor electron ide linux macos playground roslyn windows

NetPad

A cross-platform C# editor and playground.

build CodeQL

Get Started

NetPad is a C# playground that lets you run C# code instantly, without the hassle of creating and managing projects. Open NetPad, start coding, hit Run, and see your output immediately. It's that simple.

See Features.

If you like this project, please star it :star2: and consider contributing.

Motivation

We love LINQPad, but we miss its tremendous utility when working on non-Windows platforms. This project aims to create an open-source, web-enabled, cross-platform alternative.

The goal isn't to reach 100% feature parity with LINQPad, but to offer an effective alternative that covers features most commonly used and to introduce a few new useful ones.

Requirements

The following must be installed to use NetPad:

Additional requirements only if you plan to create and use database connections:

Download

Download the latest version for free!

For folks on Arch Linux or Manjaro, you can also install it from the AUR.

On macOS see this if you have trouble opening NetPad.

Updates

NetPad automatically checks for updates each time you start the application and will notify you when a new version is available.

Currently, automatic updates are not supported, but this feature will be added to make updating as seamless as possible. Stay tuned for future updates!

The latest version can be downloaded from the Releases page.

Wiki

The Wiki is a great place to find more information about NetPad.

Troubleshooting

See the Troubleshooting section of the Wiki.

Contribution

All Pull Requests, feedback and contributions are welcome!

Also a special thanks to the NetPad's wonderful sponsors. Sponsorships help pay for macOS builds and helps me maintain this project.

mattjcowan    lpreiner    jdonohoo    ChristopherHaws    smashedtoatoms    pelsedyr   

If you enjoy using NetPad and would like to support its continued development, consider sponsoring the project. A small contribution, like the cost of a cup of coffee ($5) per month, helps immensely with maintenance and the addition of new features. Thank you for your support! :heart:

Join our Discord server to collaborate with the community.

Features :rocket:

Roadmap :construction:





Tech Stack :computer:

How it works

NetPad runs an ASP.NET web app that hosts a web-based user interface. It can be packaged as an Electron desktop app or served and accessed on any browser.

Communication between the user interface and the ASP.NET backend occurs via HTTP and SignalR.

Build

This section describes how to build and run NetPad from source. NetPad can be run as an Electron desktop app or as a web application accessed with a web browser.

Requirements

NetPad as an Electron desktop app

1. Run the SPA

# Install dependencies
cd src/Apps/NetPad.Apps.App/ElectronHostHook
npm install

cd ../App
npm install

# Start the development web server
npm start

2. Run the .NET app

Install the Electron.NET CLI tool:

dotnet tool install ElectronNET.CLI -g

Start the app:

cd src/Apps/NetPad.Apps.App

# Start in watch mode (remove '/watch' to run without watch mode)
electronize start /watch /manifest electron.manifest.dev.js

# For macOS ARM, append the following to the 'electronize start' command
/target custom "osx-arm64;mac" /electron-arch arm64
Note

Only the very first electronize start is slow. Later runs are much faster.

NetPad as a Web app (accessed from a browser)

1. Run the SPA

# Install dependencies
cd Apps/NetPad.Apps.App/App
npm install

# Start the development web server
npm run start-web

2. Run the .NET app

cd Apps/NetPad.Apps.App
dotnet watch run --environment Development

and access the app via your web browser, ex: http://localhost:57930

Packaging :package:

The Electron app is built and packaged using electron-builder. Configuration is in the electron.manifest.js file.

Build the app for the desired platform from the root directory of the NetPad.Apps.App project:

# For x64:
electronize build /target win /manifest electron.manifest.js /PublishSingleFile false
electronize build /target osx /manifest electron.manifest.js /PublishSingleFile false
electronize build /target linux /manifest electron.manifest.js /PublishSingleFile false

# For macOS ARM:
electronize build /target custom "osx-arm64;mac" /electron-arch arm64 /manifest electron.manifest.js /PublishSingleFile false

Packaged files can be found in the bin/Desktop folder.

Notes
  1. To build flatpak files the flatpak and flatpak-builder packages need to be installed.
  2. On Linux, the /scripts/package-electron.sh script can be used to package the Electron app, in which case packaged files can be found in the /dist/ folder.

See the Electron.NET docs for additional CLI options when packaging the app, and electron-builder for additional configuration options.

Resources :books::