Import sodx file as a msbuild task

  • 23 September 2011
  • 2 replies
  • 0 views

Badge +3

Has anyone tried to use the SmartObjectManagementServer class and PublishSmartObjectFromLocal method?


Some of our uses use Smart Object associations when they create SOs to easy generate reports. This causes an error when we deploy the SOs, because the sequence they are deployed in creates a dependency error. i.e. order – order line will not deploy if the sequence in the generated deploy pack is wrong. The workaround is to import the dependent sodx first, with SO tester.


We need to automate this step and plan to use the SmartObjectManagementServer to do that. It looks like there are different xml versions for a smart object and this method does not say what it needs. Only string xml.


So does anyone have an idea of this? Basically: How to I publish/import a sodx file with code?


Cheers


Jan


2 replies

Badge +11

Divide your SmartObjects into different projects and then just deploy them in the correct sequence.

Badge +3

Yes and that is the current workaround. I don't think that was the elegent way of solving it, but thanks for the input.


Here is how I solved it (if anyone wants to know)


custom msbuild task in deploy pack that adds the sodx file in front of deployment:


use the Create method on SmartObjectDefinition with a FileStream object as input


import the file with SmartObjectManagementServer.PublishSmartObjectFromLocal(smartobjectdefinitionobj.ToXml(),"category")


Jan


 

Reply