0
votes

Other than the included documentation I could only find one example online of creating a Template Library in Rad Studio. http://docwiki.embarcadero.com/RADStudio/XE2/en/Creating_Template_Libraries http://blogs.embarcadero.com/pawelglowacki/2011/11/28/39454

The 2 examples were identical, except the second fixes some broken xml tags in the first.

I think I've followed it to a TEE, but my template isn't displaying. I've created a sample dll project (SampleDLL.cbproj) in bdstemplates\SampleDLL, which compiles fine. In BDSTemplates I created the following file:

<TemplateLibrary Version="1.0" id="NutanaObjects">
         <Name>NutanaObjects</Name>
         <Description>Nutana Sample Projects</Description>
         <Items>
          <Item id="SampleDLL" Creator="Marc Pelletier">
            <Name>SampleDLL</Name>
            <Description>Sample DLL/</Description>
            <Author>Marc Pelletier</Author>
            <Icon>SampleDLL\Nutana.ico</Icon>
            <Projectfile>SampleDLL\SampleDLL.cbproj</Projectfile>
            <DefaultProjectName>NuDLL</DefaultProjectName>
            <FilePath>SampleDLL</FilePath>
           </Item>
         </Items>
</TemplateLibrary>

When I add the template library in the Template Library tool it seems to import, but when I go to properties there is nothing there, nor under File|New.

One complication may be that not ALL of my files are included in the template directory. Some files common to many projects are in other parallel folders. Is that the problem? I definitely don't want a copy of each of these files in each project.

1

1 Answers

0
votes

The issue with the bdstemplate above is the Creator tag. After lots of futzing and a reread of the embarcadero page I discovered that there only 2 acceptable values for it.

Project Type    Item Creator Attribute Value
C++ Projects    Creator="CBuilderProjectRepositoryCreator"
Delphi Projects Creator="DelphiProjectRepositoryCreator"

Then I discovered the category tag within the RADStudioRepository.xml file which is in your %AppData% folder. Adding this tag as a part of the item causes it to appear in its own folder under "New Items".

<Categories>
   <Category Value="Borland.CBuilder" Parent="Borland.CBuilder">Nutana Projects</Category>
</Categories>

enter image description here

which is very cool. I briefly got the "Nutana Projects" folder inside the C++Builder Projects folder but I don't know how I did it and can't repeat it.

When creating a new project this way it asks for a destination folder then throws an error that it can't open .cbproj. Everything is ok though, you just have to open your new project manually. I suspect it has something to do with the FilePath or DefaultProjectName tags, which don't seem to be doing anything.

And there doesn't seem to be a problem with the external dependencies, although I haven't tried moving the project somewhere odd, to see if it adjusts the paths.