Documentation > CMS Template API Library > Asset > AddDependencyTo(Asset)

AddDependencyTo

Adds a dependency on this asset to the provided asset. So when this asset publishes, it will check the asset or its children and see if they need to be published.

public System.Void AddDependencyTo(Asset)

Parameters

NameDescriptionType
dependentAsset The dependent asset which will be the child. CrownPeak.CMSAPI.Asset

Code Example

C#

Sample:
<%
// If a new child is added to the Press Releases folder and published, publish the Index

Asset dependentAsset = Asset.Load("/Site/Press Releases/");
Asset indexAsset = Asset.Load("/Site/Index");
indexAsset.AddDependencyTo(dependentAsset);
            
%>

Connect with Crownpeak