Are those simply unions and records that you want to use from the client side, or do you also want to be able to call methods from those types?

In either case, importing WebSharper.targets and adding WebSharperProject = Library is enough to instruct WebSharper to compile, without needing to reference WebSharper dlls.

If you do want to compile method definitions, you can mark them with [<ReflectedDefinition>] (for which [<JavaScript>] is a synonym). But the problem is that those methods most likely use F# standard library functionality. So the WebSharper compiler will need to have references to the standard library proxies present in WebSharper.Main, WebSharper.Control and WebSharper.Collections. Even something as simple as using the + operator needs WebSharper.Main. Unfortunately there is currently no way, when using WebSharper.targets, to pass extra references to the WebSharper compiler that were not also passed to the F# compiler. It shouldn't actually be too hard to do, so I posted a ticket to implement it.

In the meantime, you could replace the whole WebSharper.targets + WebSharperProject solution with a manual call to the WebSharper compiler:

WebSharper.exe -r WebSharper.Main.dll -r WebSharper.Collections.dll [etc...] input.dll output.dll
By on 11/16/2015 9:02 AM ()

I have implemented and tested that ticket, it is indeed simple enough. If you apply this patch to your local WebSharper.targets (or wait for the next NuGet release) and put the following in your project file in addition to importing WebSharper.targets and setting the WebSharperProject property to Library, then WebSharper will compile it without needing actual references to WebSharper dlls:

    <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Collections.dll"/>
    <WebSharperReference Include="..\packages\WebSharper.\lib\net40\WebSharper.Control.dll"/>
    <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"/>
By on 11/16/2015 10:22 AM ()

Thank you very much Loic for the reply! I figured out that WebSharper.targets was looking for WebSharper's reference paths and I ended up doing exactly what you described. It works fine thanks.

By on 11/16/2015 3:41 PM ()
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