RequireAttribute is now right in WebSharper namespace, so if you have using WebSharper, it should be available the same as JavaScript.

You can do [Require(typeof(MyResource))] on a class or member, or use the new feature that you can pass along constructor parameters, so use BaseResource without inheriting: [Require(typeof(WebSharper.Core.Resources.BaseResource), "test.js")].

Did this help? You can check out the C# templates of http://websharper.com/Zafir.vsix in VS2015/17 for a basic setup.

By on 9/5/2017 7:29 AM ()

This helped, thanks! I also figured that I was using an old version 4.0.160 (instead of current 4.0.188), where the Require attribute was somehow broken.

By on 9/6/2017 12:43 AM ()


automatically updating vsix extension will be coming soon with the WebSharper 4 stable release.

However, that would affect only newly created projects, still not updating your existing project's references. With the Zafir packages we remained at 4.0.x version with different flags, so properly setting up NuGet dependencies with version ranges was not included. Please update all your packages to latest to solve metadata incompatibility (your Zafir.CSharp which contains the compiler is still on beta-6 and can't handle newer base library).

By on 9/6/2017 1:02 AM ()

Thanks for a really quick reply! I figured that myself, so I deleted that part of the message. I also removed the old "WebSharper for C#" extension, because it seems it's only one extension now, both for F# and C#.

By on 9/6/2017 1:07 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