The culprit here is that CloudSharper hasn't been brought up to date with the latest WebSharper. What happens goes roughly like this:

1) When you create this project via WebSharper example page / Source tab / Run in CloudSharper, the WebSharper site sends the example code and the list of Nuget references (WebSharper.O3D in this case) it requires to CloudSharper.

2) CloudSharper initializes a new workspace from the code and a given template (WebSharper.Html SPA), and adds the necessary Nuget references to packages.config in the root of the solution. The issue you are running into arises from the fact that these references are added without a version and end up defaulting to their latest version.

3) This causes CloudSharper to fetch the latest WebSharper.O3D (3.6.x) and using that with the otherwise 3.1-based compilation pipeline. This yields the errors you saw.

The solution is to manually change the Nuget version for WebSharper.O3D back to the last 3.1 version (3.1.2.188). You can do this by:

1) Changing the appropriate line in packages.config to:

1
2
3
4
5
<?xml version="1.0" encoding="utf-8"?>
<packages>
  ...
  <package id="WebSharper.O3D" version="3.1.2.188" />
</packages>

2) Changing the reference in the project file as well:

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  ...
  <ItemGroup>
    ...
    <Reference Include="WebSharper.O3D">
      <HintPath>..\packages\WebSharper.O3D.3.1.2.188\lib\net40\WebSharper.O3D.dll</HintPath>
    </Reference>
  ...
</Project>

3) Optionally, removing the 3.6.x WebSharper.O3D folder from packages.

4) Reopening the workspace, or right-clicking on packages.config and selecting Restore Packages.

Hope this helps.

By on 4/4/2016 10:51 AM ()

Thank you for the quick reply. I will give this a try as soon as I can. It might be helpful to include a note on the example to prevent others from getting stuck on this.

By on 4/4/2016 4:44 PM ()
1
2
3
4
5
6
7
8
9
10
11
let MakeAndBindTexture (gl : WebGL.RenderingContext) f =
    Img []
    |>! Events.OnLoad (fun img ev -> // *** PROBLEM HERE ***
        let tex = gl.CreateTexture()
        gl.ActiveTexture(gl.TEXTURE0)
        gl.BindTexture(gl.TEXTURE_2D, tex)
        gl.PixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1)
        gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img.Dom)
        gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
        gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
        f ())

It seems to be complaining about "(fun img ev ->" on line 3 of the above snippet.

The editor likes it better if I remove the "ev" argument, but it still generates the same build error.

By on 4/4/2016 8:24 AM ()

Could you please post the relevant piece of code (Client.fs, line 103)?

By on 4/4/2016 12:54 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper