8

We have two publications (Desktop Publication - Parent and Mobile Publication - Child).

In compound templating setup, we have two projects which contains Template classes with same name in both projects that does different functionality.

We are unable to upload the second project in child publication(Mobile) which has the same class name(Builder) as of the assembly in parent publication(Desktop) even after localizing the common named TBBs in child publication. Am getting the above error in TcmUploadAssembly tool.

Could someone help me to achieve this scenario where i need to achieve two different functionality in different publications using different assemblies with same class name just by localizing the TBB. Your early response is appreciated.

Note: If the assembly name been same in both publications, am able to upload the assembly after localizing the TBBs but only the Desktop class functionality been called in Mobile components too.

Please find below the sample compound templating project setup. I need the classes to be uploaded separately in two different publications:

namespace Desktop
{
    [TcmTemplateTitle("Builder")]
    public class Builder : ITemplate
    {
       //Desktop code here
    }
}

namespace Mobile
{
    [TcmTemplateTitle("Builder")]
    public class Builder : ITemplate
    {
        //Mobile code here
    }
}
13

I would upload your mobile specific Assembly and TBBs to a separate folder. You then have 2 options:

  1. Localize your CT/PT to put the local mobile TBB instead of the desktop version
  2. Localize your TBB, open it and go to the source tab, edit the C# fragment to point the TBB at the mobile assembly Uri and class name.
  • Thanks Will. This requires much manual work. I think it is a SDL issue which denies the TcmUploadAssembly to modify the TBBs even after localizing the same. – Jaison Prabhu Doss Jun 12 '13 at 9:03
  • I would be interested in what aspect of your implementation requires that so many .NET TBBs are localized for mobile that it would qualify as 'much manual work'. Typically mobile variations are handled by the visual part of the template (Dreamweaver or Razor TBB for example) and not in the .NET part. – Will Price Jun 12 '13 at 9:13
4

There is a reason you cannot and should not be able to do what you are trying. Consider these axioms and the following scenario:

  • TcmUploadAeembly uploads the DLL as a .NET assembly TBB
  • for each TBB inside the DLL creates a C# Fragment TBB pointing to a class within the assembly.

Now consider this scenario:

  • You localize the Assembly TBB and all the C# Fragment TBB that it created.
  • In the localized version of the assembly you create a new TBB and upload. This would create a new local C# Fragment TBB
  • Later you decide to create a TBB with the same name in the original publication. You now can't upload it because another TBB with that name ready exists in the Blueprint.
  • OR you later unlocalize the assembly. That new C# Fragment suddenly will point to an invalid class.

What Will had suggested in his answer in my opinion is the correct approach. Localizing assemblies is a bad idea and will get you into a much bigger mess at a later point in your implementation's lifetime.

3

Thanks all for your answers. I have fixed this issue by keeping separate .net projects for Mobile and Desktop version. The dll name for both projects remains the same. I uploaded the Desktop projects dll to the parent publication in blueprint(Desktop) and then after localizing all the TBBs and the dll in child publication(Mobile) i was able to upload the Mobile projects dll to the child publication using TcmUploadAssembly tool itself. Also i have the common utilities built as a separate project and deployed the same in GAC. This framework been designed to have different functionality for Mobile and Desktop for the same CT and PT just by localizing the .Net TBBs.

2

What I have understand from your question is that you want to add Two C# TBBs having same class name, If this is what you want to achieve, then decorate your C# TBB class with TcmTemplateTitle custom attribute and give different name to them as shown below:

[TcmTemplateTitle("Mobile_Base")]
public class Mobile : ITemplate
{
  //Your Code
}

[TcmTemplateTitle("Mobile_Child")]
public class Mobile : ITemplate
{
  //Your Code
}

I hope it helps, if you have any other issue you want to explain, then request you to kindly provide more clarification/examples.

UPDATE:

Have a different project and different AssemblyInfo.cs for Desktop and Mobile and try after changing the TCm URI of your TCM Target Folder for Mobile version to target to the Folder of your child publication in which you want to localize it. You may want to do this in your AssemblyInfo.cs file as shown below:

[assembly: TcmTargetFolder("tcm:15-39-2")]

You may explore more options for specifying the Target Folder instead of creating separate project.

I hope it helps

  • This creates different TBBs in CME. I doesnt need that. I need a single TBB which would be localized in child publication to provide different behavior. Could you please help. – Jaison Prabhu Doss Jun 12 '13 at 8:10
  • Thanks Pankaj : Added the sample in my question. Can this be done by localizing the TBB. We have lot of CTs that refer to the existing .Net TBBs in desktop version. Now we need to use the same in Mobile version just by localizing the .Net TBB and provide a different functionality of the same without changing the CT. Could you please provide a solution to achieve this? – Jaison Prabhu Doss Jun 12 '13 at 8:58
  • 1
    Have you tried by changing the path of Source Folder before uploading the Mobile Version, so that it actually get loaded in the Folder of the publication where you have localized it? See the Update in the Answer. – Pankaj Gaur Jun 12 '13 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.