WebSharper 4 (codename Zafir) beta-1

@Jand42 Jand42 released this Aug 18, 2016 · 193 commits to master since this release

New C# support and improved F# features are coming to WebSharper.

New in 4.0

  • A C#-to-JavaScript compiler, fully compatible both ways with F# libraries.
  • Many new .NET framework features are usable client-side, including delegates, Tasks (usable for remote calls too), Linq methods.
  • Code dependency exploration for smaller output for single-page applications.

Try it

Project templates

Download the latest Visual Studio extension installers here:

In the 'New Project' dialog you can find project templates in the 'Zafir' section under Visual C# or F#.

Xamarin Studio and MonoDevelop upcoming.

In your browser

Try WebSharper has been updated for WebSharper 4 beta, including C# support.
Code service also shows WebSharper-specific errors and warnings for both languages.


C# compiler and tools

  • Code analyzer marking WebSharper translation errors as you code.
  • New API for creating reactive DOM nodes and defining Sitelets (type safe site map) from C#.
  • Full list of C# syntax currently supported and planned for stable release
  • We are continuously expanding C# features, tests, APIs and documentation.

New F# features

  • Not relying on ReflectedDefinition produces smaller .dll files and have improved compilation running time.
  • All F# language features are now supported, including object expressions, byref and & operator, inner generic functions, pattern matching on arrays, statically resolved type parameters.
  • Correct object-oriented behavior in JavaScript translation. WebSharper now fully supports method overrides, interface implementations, static constructors, base calls, constructor chaining, having no implicit constructor, self identifier on constructors.
  • Module let values now work as in .NET, not all initialized semi-randomly on page load, only on first access of a value from a single file.
  • Better error reporting, translation failures are reported at the exact location of the expression.
  • For upgrading your WebSharper 3 projects, check out the update guide.


Websharper.com documentation page has been updated for WebSharper 4 beta, including pages for C#.

This is a work in progress, you can find the full source for the documentation pages in the websharper.docs repository, comments and contributions are welcome.

Package naming

WebSharper 4 is codenamed 'Zafir' (Sapphire in Hungarian).
Stable release of packages will be named WebSharper.X with version 4.0.
We are planning to rework the build system for extensions, so that we can have cleaner package versioning, and no unnecessary updates for packages with no changes.
In the meantime all NuGet package names for WebSharper 4 beta are Zafir.X.

Beta warning

Most planned changes until stable release are related to metaprogramming (macros and generators), compiler API, cleanup and optimizations, and extra features like TypeScript interoperability.
However, other breaking changes are possible while the project is in beta phase.

Happy coding!