By Loïc Denuzière on Monday, November 23, 2015 — 2 comments

WebSharper 3.6 released with CDN supportCore team

We are happy to announce the release of WebSharper 3.6.

The main new feature is the capability to point to our CDNs for the WebSharper libraries. You can simply add the following setting to your application configuration file (Web.config or App.config depending on the project type):

  <add key="WebSharper.StdlibUseCdn" value="true" />

The links generated by WebSharper, instead of pointing to /Scripts/WebSharper/... for scripts and /Content/WebSharper/... for CSS, will point to //cdn.websharper.com/{assembly}/{version}/{filename}. You can configure this URL by setting the WebSharper.StdlibCdnFormat configuration setting. And finally, you can configure the CDN URL for the resources of a specific assembly (from the standard WebSharper library or not) by setting the WebSharper.CdnFormat.{assemblyname} configuration setting.

Here is the full change log:

  • #488: Allow adding a macro attribute on a type. The macro is invoked for all static and instance method calls on this type.

  • Fix issue preventing macro use in argument to a PropertyGet/Set.

  • #490: Retrieve appConfig parameters from Web.config or App.config when building a single-page application.

  • #493: Add WebSharperReference project item. This allows you to pass references to the WebSharper compiler that are not referenced by the compiled assembly. For example, adding the following to your project file:

      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Core.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Core.JavaScript.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.JavaScript.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.JQuery.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Main.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Control.dll" />
      <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Collections.dll" />

    and removing the corresponding <Reference> entries allows you to use the proxies from the standard libraries without referencing them in your assembly.

  • Add AssemblyFileVersionAttribute to all standard library assemblies.

  • #494: Add support for pointing resources to a CDN (see above).

  • #495: Add proxies for {Int32,Double,DateTime}.{MinValue,MaxValue}.

  • #496: Add proxy for String.IsNullOrWhiteSpace.

Happy coding!

By Loïc Denuzière on Thursday, November 12, 2015 — 0 comments

WebSharper 3.5.16 releasedCore team

We are happy to announce the release of WebSharper 3.5.16 available through the usual channels. Here is the change log:


The unit testing framework WebSharper.Testing has been split into a separate NuGet package.

This fixes the issue where QUnit was included as a script in Single-Page Applications even when it wasn't actually used.


  • #486: Reference the correct version of FSharp.Core in the MSBuild task. This fixes issues such as Json.Serialize failing to compile when running MSBuild from the command line.

  • #489: Null argument exception when building on mono.


  • #17: Add try...with, try...finally and return! to the View.Do computation expression.

  • #19: Add View.Sequence : seq<View<'T>> -> View<seq<'T>>.

  • #55: In the templating type provider, translate <[CDATA[...]]> blocks to Doc.Verbatim.

  • #56: Don't delete some text nodes when updating the view.

  • #57: Fix genericity error on the <~ update operator in Notation.

Happy coding!

By Adam Granicz on Wednesday, November 4, 2015 — 0 comments

Data-aware workbooks and client-side data access with WebSharper.DataCore team

F# has always excelled at accessing heterogeneous data sources in server-side code through its unique type provider feature: a metaprogramming technique that enables generating (or "providing") domain-specific code to be consumed during compilation, such as generating typed schemas for relational databases, CSV and other data files, or bindings for web services and integration with other languages such as R. Type providers are given an optional set of arguments in your code using custom F# syntax, yielding a type space in return.

For instance, FSharp.Data provides access to various forms of structured data (XML, CSV, etc.) and the WorldBank database via its web API. You can now access some of this data, from client-side code in your WebSharper applications with WebSharper.Data.


WebSharper.Data provides various proxies for FSharp.Data, currently supporting the JsonProvider and the WorldBankProvider runtimes in client-side use with WebSharper.

Below is a snippet that uses WebSharper.Data and WebSharper.Charting to provide a workbook with data obtained from the WorldBank database.

A wide array of other data-aware scenarios are possible, below is another simple snippet that works out of the GitHub issue database and displays a list of open tickets for the WebSharper repository.

Happy coding!

By András Jankó on Friday, October 30, 2015 — 0 comments

WebSharper 3.5.14 releasedCore team

This is a small bufgix release for SPA projects. Change log:


  • The bundle command (a.k.a Single-Page Application) now extracts non-JS, non-CSS WebResources into /Content.
  • #483: Cleaning a bundle project does not fail if output folder does not exists.

Happy coding!

By Loïc Denuzière on Wednesday, October 28, 2015 — 0 comments

WebSharper 3.5.13 releasedCore team

We are happy to announce the release of WebSharper 3.5.13, with minor features and bug fixes. Here is the full change log:

Visual Studio Extension

  • #2: Add supported product: Visual Studio 2015 Enterprise Edition.


  • The bundle command (a.k.a Single-Page Application) now extracts non-JS, non-CSS WebResources into /Content.

  • #482: Fix the serialization of None and other values represented as null in .NET when passed to inline controls (ClientSide <@ ... @> in WebSharper.Html, client <@ ... @> in UI.Next).

  • Don't fail silently when failing to initialize a Sitelet from a [<Website>]-annotated static property.


  • Doc is now an abstract class, rather than an interface.

  • Most extension methods have been changed to C#-style extension methods.

  • Add Doc.Async : Async<#Doc> -> Doc.

  • #52: Fix over-eager loading of assemblies in the templating type provider, which could cause conflicts due to file locking.


  • Add Doc.ShowErrors : View<Result<'T>> -> (list<ErrorMessage> -> Doc) -> Doc, also as an extension method on View<Result<'T>>.

  • Add Doc.ShowSuccess : View<Result<'T>> -> ('T -> Doc) -> Doc, also as an extension method on View<Result<'T>>.

Happy coding!

By Loïc Denuzière on Wednesday, October 21, 2015 — 0 comments

WebSharper 3.5.9 releasedCore team

We just released version 3.5.9 of the WebSharper stack. This is mostly a bugfix release, with a few shorthands added to the UI.Next API.

Change log


  • #477: Fix translation to JavaScript of mutable variables used from a closure (F# 4.0 feature).

  • #478: Fix encoding of web controls by the ASP.NET ScriptManager.

  • #479: Fix currying of local functions in some edge cases.

  • #480: Fix division involving large negative integers.

  • #481: Include "Z" UTC indicator in server-side System.DateTime JSON serialization.

  • Ignore final slash in table-based Sitelets routing, thus fixing WebSharper.Suave #1.


  • #1: Restore Html.Server.Web.Control and fix the JSON encoding of any client-side controls it contains.


  • #43: Use keypress instead of keyup for IE8-compatible input detection in the Attr.Value and Doc.Input families of functions. This makes it possible to use on.keyup for other purposes, such as catching Enter to submit the input.

  • Add Submitter.CreateOption : View<'T> -> Submitter<option<'T>>. This creates a Submitter with initial value None, that maps the input view through Some when triggered.

  • Rename the View.Convert and Doc.Convert families of functions as follows:

    View.Convert      -> View.MapSeqCached
    View.ConvertBy    -> View.MapSeqCachedBy
    View.ConvertSeq   -> View.MapSeqCachedView
    View.ConvertSeqBy -> View.MapSeqCachedViewBy
     Doc.Convert      -> Doc.BindSeqCached
     Doc.ConvertBy    -> Doc.BindSeqCachedBy
     Doc.ConvertSeq   -> Doc.BindSeqCachedView
     Doc.ConvertSeqBy -> Doc.BindSeqCachedViewBy

    The old versions still exist for backward-compatibility, but are marked obsolete.

  • Add extension method equivalents on View<'T> for all of the above. They are overloaded: all variants of View.MapSeqCached have an equivalent v.MapSeqCached(), and all variants of Doc.BindSeqCached have an equivalent v.DocSeqCached().
    Additionally, Doc.BindView has an equivalent v.Doc().

Project Templates

The UI.Next project templates in the Visual Studio extension and the Xamarin Studio addin have been updated:

  • The SPA project uses People.View.DocSeqCached() instead of ListModel.View People |> Doc.Convert.

  • The Client-Server projects now use a reactive style for the small client-side code sample, instead of the previous imperative style.

Happy coding!

By Adam Granicz on Wednesday, October 7, 2015 — 0 comments

Announcing WebSharper 3.5 with pluggable HTML supportCore team

We are happy to announce the availability of WebSharper 3.5, bringing a couple important changes and numerous bug fixes.

Most notably, this release brings alternate HTML implementations to your WebSharper applications, and while there are only two at the moment, new flavors and variations (both in syntax and capabilities), and integrations with third-party markup engines are coming your way soon.

Swappable HTML language support

WebSharper always shipped with standard HTML support in Html.Client and Html.Server for constructing client/server markup. In an effort to bring additional markup functionality and new markup alternatives for your applications, WebSharper 3.5 introduces a less tighly coupled setup and leaves the actual markup implementations to be chosen freely.

This means that WebSharper 3.5+ applications will reference their actual choice(s) of HTML implementations (won't be auto-referenced via WebSharper any longer), and these in turn can evolve separately from the main WebSharper toolset, giving a way to incorporate novel ideas and new capabilities in constructing markup.

Reactive applications with UI.Next

Going forward, you are encouraged to try the reactive HTML implementation shipped with WebSharper.UI.Next. UI.Next also brings enhanced templating capabilities beyond those in the standard Html.Server templates, giving you type-safe, reactive HTML templates that are stunningly easy to work with. You can read about UI.Next here, while the documentation for UI.Next templating will be added shortly.

You can also find a number of UI.Next-based project templates shipped in the main VSIX installer and the MonoDevelop/Xamarin Studio integration, to help you get started with developing reactive WebSharper applications.

Standard HTML support now available as a separate Nuget

The previous HTML support (Html.Client and Html.Server) has moved to a separate repository and Nuget package called WebSharper.Html, so to continue using this implementation you will need to reference WebSharper.Html in your 3.5+ applications.

WebSharper + Suave template

Next to the recent WebSharper.Suave announcement, WebSharper 3.5 now also ships a new project template for Visual Studio, MonoDevelop, and Xamarin Studio for running WebSharper applications on Suave. This template implements the standard client-server WebSharper "sample" application, and is easy to modify to fit your needs for any full-stack F# web application running on Suave.

Full change log

The list of other changes and bug fixes to WebSharper and components since the previous release are the following:


  • #476: Add proxies for static members FSharpOption.Some and FSharpOption.None
  • #474: Add ability to set content type directly in Content.File


  • #45: Rename Content.Doc to Content.Page
  • #46: Restore Attr.ClassDynPred
  • #47: Add Doc.RunAppend, RunPrepend
  • #48: Templating: add .Elt() when template is a single element
  • #49: Templating: pure-whitespace nodes are ignored

The released bits on are Nuget for you to try - and your feedback is welcome. The easiest way to get in touch is joining the WebSharper chat room on Gitter. See you there!

Happy coding!

By István Gansperger on Tuesday, October 6, 2015 — 0 comments

Try Websharper: version info about extensions and some embedding improvementsCommunity

Try WebSharper has been updated with some minor improvements regarding version info and embedding snippets.

  1. There is now an About button which shows a dialog with all the relevant version info of the extensions and a version number for Try WebSharper itself. We are going to do our best to keep all the extensions up-to-date.

  2. It is now possible to point at a given tab of an embedded snippet instead of showing the Result one by default. You can do it by specifying the tab in the URL by a hash:

    • #f-sharp: F# editor
    • #html: HTML editor
    • #result: Result tab

Happy coding!

By Loïc Denuzière on Thursday, October 1, 2015 — 3 comments

Announcing WebSharper.SuaveCore team

We are happy to announce the release of WebSharper.Suave, an adapter to run WebSharper applications on Suave.

With WebSharper.Suave, creating a Suave WebPart from a WebSharper Sitelet is as simple as a single function call.

module Main

open WebSharper
open WebSharper.UI.Next.Html

module Client =
    open WebSharper.JavaScript
    open WebSharper.UI.Next.Client
    open WebSharper.Charting

    let RadarChart () =
        let labels =    
            [| "Eating"; "Drinking"; "Sleeping";
               "Designing"; "Coding"; "Cycling"; "Running" |]
        let data1 = [|28.0; 48.0; 40.0; 19.0; 96.0; 27.0; 100.0|]
        let data2 = [|65.0; 59.0; 90.0; 81.0; 56.0; 55.0; 40.0|]

        let ch =
            Chart.Combine [
                Chart.Radar(Seq.zip labels data1)
                    .WithFillColor(Color.Rgba(151, 187, 205, 0.2))
                    .WithStrokeColor(Color.Rgba(151, 187, 205, 1.))
                    .WithPointColor(Color.Rgba(151, 187, 205, 1.))

                Chart.Radar(Seq.zip labels data2)
                    .WithFillColor(Color.Rgba(220, 220, 220, 0.2))
                    .WithStrokeColor(Color.Rgba(220, 220, 220, 1.))
                    .WithPointColor(Color.Rgba(220, 220, 220, 1.))
        Renderers.ChartJs.Render(ch, Size = Size(400, 400))

open WebSharper.Sitelets
open WebSharper.UI.Next.Server

let MySite =
    Application.SinglePage (fun ctx ->
            Body = [
                h1 [text "Charting on Suave is easy with WebSharper!"]
                div [client <@ Client.RadarChart() @>]

open Suave.Web
open WebSharper.Suave

startWebServer defaultConfig (WebSharperAdapter.ToWebPart MySite)

This opens up awesome ways to combine Suave and WebSharper applications, and we are excited about the synergies this will bring to the F# web programming community.

Happy coding!

By Loïc Denuzière on Thursday, September 24, 2015 — 0 comments

WebSharper 3.4.19 releasedCore team

We are happy to announce the release of version 3.4.19 of the WebSharper stack, which you can download here. This release is mainly dedicated to bug fixes and minor features.

Xamarin Studio / MonoDevelop addin on the main channel

The WebSharper addin is now available on the main Xamarin Studio channel. This means that you can now drop the githubusercontent.com-based custom repository, and grab WebSharper directly from Xamarin instead! Simply check the "Web Development" category in the addin manager's gallery.

UI.Next Checked number inputs

The main new feature (and breaking change) is in UI.Next. The functions Doc.IntInput and Doc.FloatInput, which associate a Var<int> or Var<float> to a <input type="number"> element, took little care to check the correctness of the actual text entered by the user. This could result in awkward and even browser-inconsistent user experience, where mistakenly entering "1e" would return 1 on some browsers and 0 on others.

These combinators have therefore been modified to perform more input checking and bind the value to a Var<CheckedInput<_>>, with the following definition:

type CheckedInput<'T> =
    | Valid of value: 'T * inputText: string
    | Invalid of inputText: string
    | Blank of inputText: string

This way, typing "1e" consistently sets the Var to Invalid "1e".

The old behavior can still be achieved using Doc.IntInputUnchecked and Doc.FloatInputUnchecked, but is not advised.

Full change log

Here are the minor changes and bug fixes to WebSharper and components since the previous release.


  • #402: Fix exception when compiling a WebSharper project that references a Roslyn-compiled assembly.

  • #467: Add JS.RequestAnimationFrame and JS.CancelAnimationFrame, with a shim for IE9-.

  • #470: Fix the printf family of functions for union cases with [<Constant>] attributes.

  • #471: Fix exception on mono when looking for a [<Website>] if a dependent assembly is missing.

  • #473: Add server-side JSON serialization of the unit type.

  • Add missing proxy for jQuery.parseHTML.


  • #31: Add Doc.Verbatim to create a Doc from verbatim HTML. Be careful not to use it with user input data!

  • #33: camelCase on Expr-based events (eg. on.keyUp instead of on.keyup).

  • #34: make IntInput and FloatInput checked (see above).

  • #36: Add attr.``data-`` combinator to WebSharper.UI.Next.Html to create data-foo="value"-type attributes.

  • #37: Add Doc.SelectOptional, which adds a first selectable option that sets the Var to None.

  • #38: Add Doc.SelectDyn and Doc.SelectDynOptional, for which the list of available options comes dynamically from a View.

  • #39: Add View.MapCached, which is identical to View.Map except that it doesn't call the mapping function again if the input value is equal to the previous input. Useful if the mapping function is computationally expensive. Note that the output is still marked obsolete, it is simply re-filled with the same cached value.

  • #40: Add Doc.WebControl, which allows including a WebSharper.Web.Control inside a server-side Doc.

  • #41: Add .With() method overloads for WebSharper.Sitelets.Content.Template that take Docs as holes.

  • #42: Add instance member versions of Doc.Run, Doc.RunById and Doc.AsPagelet.


  • Release on the main Xamarin channel (see above).

  • #3 on websharper.templates: duplicate .fsproj file when creating a project whose name isn't also a valid identifier.

Happy coding!