Start a new topic

Reference non-DuoCode .Net libraries

I have a project I'm starting to build up. As I only want certain parts of my C# project to be converted to JS, I create a DuoCode class library and work there. That works great.

However, part of the javascript/DuoCode requires some static strings that configure the code, such as root website and some Urls. These are containing in a non-DuoCode class and are simple public const string values.

Trying to reference them in the DuoCode class fails because the referenced assembly is not a DuoCode class.

That makes sense - however it's surely simple enough when referencing non-DuoCode classes and properties to create JS instances of only those things referenced. The simplest is a const string as above, and it could just replace the variable with an actual string at compile time, or create a JS variable on it's behalf in the DuoCode library.

This would be hugely beneficial.
1 Comment

Yes, this is a limitation of DuoCode - it doesn't handle assemblies not compiled with DuoCode, We might consider implementing something in the future to handle constants, as you suggested.


In the meantime, you can either try compiling the code which has the constants as a DuoCode assembly, or add them as a Link to your project - using Add -> Existing item..., and selecting the file with the Add to Link option:


Hope this helps!


Login or Signup to post a comment