General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion How to share macro code between projects?

  • asaremba

    How to share macro code between projects?

    Participants 1
    Replies 2
    Last Activity 13 years, 7 months ago

    When working with several different (but related) doctypes, how is it possible to share common (Javascript) code between projects in XMetaL Developer? I am a bit surprised that I haven't found anything on this topic in the documentation because it is a basic software engineering practice for decades now. But maybe I'm a bit blind…

    The same question applies to the other components of an XM customization, i.e. CTM and CSS files.

    Reply

    Derek Read

    Reply to: How to share macro code between projects?

    When you add an existing file to a project you should have the option to “reference” it or copy it to the project.

    Reply

    asaremba

    Reply to: How to share macro code between projects?

    Thank you for your helpful answer. In fact I had overlooked that in the “Add existing item…” dialog box the “Add” button gives you the choice of referencing an item instead of copying it. (You may admit that this is not quite obvious, so it would make sense to document this fact.)

    Some points, however, have to be added:

    • While it is possible to add a single (isolated) script file by reference, the same is not possible for a macro script (i.e. one that is to be integrated in the MCR file). This looks to me like an oversight.
    • Fortunately, there is a workaround: If you edit the XDP file manually, changing the name of a script file to a fully qualified path name and changing ProjRelPath from T to F (this is what the “Add as link” button does in the case of non-macro script files), everything works like it should.

    (By the way, it is not very robust that shared files can only be referenced by absolute path names because it makes it impossible to checkout a project to an arbitrary location from the source code repository. I don't know whether this is a limitation of MS Visual Studio or of XmetaL Developer.)

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support