remobjects c# share code between classes

306 Views Asked by At

Using remobjects c#, does anyone know how code can be shared between projects.

I've created a class library and added it as a reference to my android and osx project but i cant access the classes from my library on android or osx using remobject c#

Thanks.

4

There are 4 best solutions below

0
On BEST ANSWER

found an answer to my question:

If you want to share code between different platforms you can add 1 file to multiple projects (when in the Add Existing File dialog, use the "Add As Link" option under the "Add" button). So say you have 3 projects, one for android, one for .net and one for osx you could have a layout like:

Android\MyProject.hydrogene<< these use linked files
iOS\MyProject.hydrogene<< these use linked files
Net\MyProject.hydrogene << these use linked files
Common\*.pas << shared files here

Reference: http://talk.remobjects.com/t/share-code-between-projects/4790/4

4
On

Do you just mean you want to share the library (the dll) between them or something different? Because to share the library, you just go to the References in the solution view and add a reference, browsing tot he path where the class library's dll is.

0
On

You cannot share a library project between different platforms — since the library will be platform specific. You can share code between apps for different platforms, by referencing the same source file(s) from both/multiple projects.

0
On

With more recent versions of Elements the project system has been extended to now support a new project type of "Shared Project", specifically to simplify this process.

To share code between projects for different platforms simply create a "Shared Project" in your solution, placing all of the code that you wish to share in that project. The Shared Project template is available for all platforms but is not itself platform specific.

In a project that wishes to use this shared code, simply add the shared code project to the References of the project wishing to use it. The Elements compiler will recognise that this is a library of shared code (rather than a shared assembly, package or other object code library) and recompile it for inclusion in the referencing project when that project is itself compiled.

Once you have a Shared Project you can then of course add it as an Existing Project to any other solutions that contain projects wishing to use it.