Skip to content

WebSharper 4.2-beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@Tarmil Tarmil released this 09 Feb 20:28
· 1360 commits to master since this release

Enhancements

.NET Standard and .NET Core support

This is the first version of WebSharper compiled for .NET Standard 2.0, and therefore compatible with .NET Core 2.0.

The compiler itself still runs on .NET Framework, due to the F# compiler's current limitations in particular when dealing with type providers. So having .NET 4.6.1 or Mono installed on development machine is still required; however the runtime is 100% .NET Standard 2.0 compatible.

ASP.NET Core support

WebSharper can now run on top of ASP.NET Core thanks to WebSharper.AspNetCore. The server-side runtime, including Sitelets as well as RPC functions, can be run on top of ASP.NET Core.

C# and F# dotnet project templates

Templates for .NET Core are now available for both C# and F#. They can be installed with the following command:

dotnet new -i WebSharper.Templates

There are four templates for each language (add -lang c# or -lang f# to choose):

  • dotnet new websharper-web creates an ASP.NET Core application with a WebSharper client-server site.

  • dotnet new websharper-spa creates an ASP.NET Core application containing a WebSharper Single-Page Application.

  • dotnet new websharper-html creates a WebSharper-generated static HTML website.

  • dotnet new websharper-lib creates a WebSharper library, compiling C# or F# code to JavaScript.

Build configuration via wsconfig.json file

If a wsconfig.json file is found next to a WebSharper project, build settings are read from it, overriding project variable setting if one exists in both places. Existing project variables all have equivalents: these are

  • "Project": WebSharper project type
  • "OutputDir": Output directory
  • "DCE": dead code elimination on/off (shortened from WebSharperDeadCodeElimination)
  • "SourceMap": source map generation on/off
  • "WarnOnly": give WebSharper errors only as warnings (shortened from WebSharperErrorsAsWarnings)
  • "DownloadResources": download all remote js/css resources for web projects.
  • "AnalyzeClosures": give warnings on unintended captures in JS closures.

New settings:

  • "JavaScript": emulate usage of JavaScript attribute on assembly level, allowing compiling full projects/files without annotating in source.
  • "JSOutput"/"MinJSOutput": write out .js/.min.js to given location.

Changes

.NET 4.6.1

In parallel to the new .NET Standard 2.0, the minimum requirement for running WebSharper on the .NET Framework has been bumped to v4.6.1.