Yes, in addition to compiling with WebSharper in order to create the js files, you also need to pass the resulting metadata to the OWIN host. In a normal project, the metadata is loaded from assembly files located in binDirectory; but here since you have a dynamic assembly, it's not enough, you need to pass the metadata explicitly. In Warp, this is done here. In your case you need to call UseCustomSitelet:

1
2
3
4
appB.(*...*)
    .UseCustomSitelet(
        Options.Create(sitelet.Metadata),
        sitelet.Sitelet)

where sitelet.Metadata is asm.Info from produceScripts.

UseCustomSitelet is marked obsolete, but it's currently the only way to pass custom metadata because we haven't added it to WebSharperOptions yet. I'll fix this oversight shortly.

By on 11/24/2015 1:07 AM ()

Hi Loic, thanks a lot for the reply!

I have changed the OWIN host and pass the metadata given from the compilation of the assembly as you mentioned but I am still getting the same error when I navigate to the \test page.

1
2
3
4
5
let options = WebSharper.Owin.Options
	.Create(sitelet.Metadata)
	.WithServerRootDirectory(@"C:\Projects\SiteletFsx\SiteletFsx\bin\Debug")
    .WithDebug(true)
appB.UseCustomSitelet(options, sitelet.Sitelet) |> ignore               

Am I missing something else?

By on 11/24/2015 4:11 AM ()

Ha, found it! Here you're shadowing the asm received as argument with a call to Assembly.GetCallingAssembly(). But since the current function compile is called from compileToWs, the calling assembly is Common, not F# interactive's dynamic assembly. Delete this line and you should be good.

By on 11/24/2015 6:46 AM ()

Argh... I feel so dumb. Thanks a lot Loic for taking the time to look at it!

By on 11/24/2015 1:38 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