It looks like you're trying to publish the same Multimedia Component (binary), tcm:200-26587, to two different Structure Groups. This is, as the error message clearly states, not allowed.
You can achieve this by creating multiple variants of the binary content.
Instead of using the Engine
class's AddBinary()
method, use an AddBinary()
method of the RenderedItem
class (available in your templating code via engine.PublishingContext.RenderedItem
).
For example, using the AddBinary() method with the following signature...
public Binary AddBinary(
Component multimediaComponent,
StructureGroup location,
string variantId
)
... and varying the variantId
parameter, should allow you to publish the same multimedia component to two different Structure Groups.
If you don't need to modify the actual binary data in any way then you can just pass the exact same Multimedia Component twice with a different variantId parameter (perhaps the Structure Group ID?) each time. The variant data is published but is never stored in the Content Manager. This will work for any Multimedia Component; Tridion does not care whether your binary data is CSS, JPEG, PDF, MP4 etc. If you need to treat different binary data types in different ways then your code will need to inspect the filename/mime type/binary data and branch accordingly.
Be careful with this functionality... Consider if you really need to publish the same binary content to two different places and ensure that your variant IDs are unique to each use case or you may run into publishing issues when your deployer is asked to move referenced binaries around later on.