Skip to content

NetPad v0.7.0

Compare
Choose a tag to compare
@tareqimbasher tareqimbasher released this 02 Apr 04:23
· 195 commits to main since this release

Preview 7

This release brings support for ASP.NET, scaffolding control, new Dump() capabilities and more!

If you like NetPad, please star the repo 🌟!

What's New πŸš€

ASP.NET Support

Open script properties (F4) and check Reference ASP.NET on the bottom left to Add ASP.NET to your script and get a web app running in seconds!

Preview

286467726-7efa7975-69d4-49ad-8549-4a6660b25f2f

A new webapp snippet is now avaialble to make it super easy to get started.

Compiler Optimizations

Select to enable or disable compiler optimizations.

Preview

image

Preprocessor Directives

A few C# preprocessor directives are now available.

Preview

image

Database Connections

Connection String

You can now manually edit the connection string.

‼️ BREAKING CHANGE: For your MS SQL Server connections, you will need to edit them and check "Trust Server Certificate". This was implicitly added previously.

Preview

image

Scaffolding Options

New options were added to give you more control over the scaffolding process.

Preview

image

Entity Framework Logs

The SQL tab now shows all Entity Framework logs, with colors, and provides a dropdown to filter them by category.

Preview

image

Override OnConfiguring

NetPad overrides the OnConfiguring method on the base DbContext to forward Entity Framework logs to the SQL tab. This means you can't override it yourself. To get around that, a new OnConfiguringPartial method is introduced and can be used like so:

partial void OnConfiguringPartial(DbContextOptionsBuilder optionsBuilder)
{
    // Your code
}

Its not as pretty πŸ˜… but a better solution is available and will be implemented in a future release.

Dump()

Enhancements

This update adds the ability to dump the following objects types:

  • Dumping media files (using the new Image, Audio and Video classes in the NetPad.Media namespace) will render them as media content the output pane.
  • Dumping JsonDocument, JsonElement and JsonNode will output their JSON representation.
  • Dumping XmlNode, XNode and other related types in System.Xml and System.Xml.Linq namespaces respectively will output their XML representation.

Additional Parameters

These new optional parameters were added to the Dump() method:

  • css: (string) css classes to add to output. You can use any Bootstrap v5 classes. Support for defining your own classes that you can use with this parameter is coming soon.
  • clear: (int) will clear dumped result after specified milliseconds.
  • code: (string) dump a code string with syntax highlighting.

See wiki for more details.

HTML Rendering (experimental)

Added basic support for HTML rendering. You can now Dump() HTML (and JavaScript!) and see it rendered in the output pane.

See wiki for examples. More documentation and examples are being added to better demonstrate usage.

Others

  • Compiled script assemblies now have the fixed name "NetPadScript" which allows you to make the internals of your own assemblies visible to your NetPad scripts like: [InternalsVisibleTo("NetPadScript")] (#157)
  • New flatpak and snap packages [untested]
  • Slightly reduced bundle size.

Fixes πŸ›

  • When you switch to a tab that is in the tab bar overflow, it is brought into view.
  • Fixed an issue with running some SQL scripts when there is a " in the query.
  • Fixed failure installing NuGet packages on non-English locales (#148).
  • NetPad will now fallback to AppData folder as the "Scripts folder" if USERPROFILE/Documents is not writeable (#134).
  • Fixed NetPad not launching properly when user has the DOTNET_ENVIRONMENT or ASPNETCORE_ENVIRONMENT global variable set to Development.

Sponsors ❀️

Thank you to my sponsors. Your support is greatly appreciated and helps keep this project growing!

If you're enjoying NetPad, please consider sponsoring it with a cup of coffee ($5) a month, every bit helps me maintain this project and deliver more features. Thank you πŸ™

Full Changelog: v0.6.1...v0.7.0