Referencing Assemblies and Sharing Code
OneStream allows you to share and reference workspace assemblies across different workspaces and maintenance units. This guide covers the setup, syntax, and best practices for creating assembly dependencies and referencing shared code.
Assembly Reference Relationships
| Arrow | Meaning |
|---|---|
| Solid line | Same-workspace reference (no Is Shareable required when using Current) |
| Dashed line | Cross-workspace reference (target must have Is Shareable = True) |
Prerequisites & Setup
Making a Workspace Shareable
Before another workspace can reference your assembly, the source workspace must be marked as shareable:
- Go to Application > Presentation > Workspaces
- Select the workspace that contains the assembly you want to share
- Set Is Shareable Workspace =
True - Click Save
Adding Shared Workspace Names
On the workspace that needs to consume the shared assembly:
- Open the workspace properties
- In Shared Workspace Names, enter a comma-separated list (no spaces) of workspace names you want to reference — e.g.,
SharedWorkspace1,SharedWorkspace2 - Click Save
The search order for items is: Current Workspace > Default Workspace > Shared Workspace Names (in the order entered).
Creating Assembly Dependencies
Dependencies tell OneStream's compiler which other assemblies your code needs. This is how you formally link assemblies together.
- In the Workspaces tree, expand your assembly
- Right-click the Dependencies label and select Add Dependency
- Choose the dependency type:
| Dependency Type | Use Case |
|---|---|
| Workspace Assembly | Reference another assembly (same or different workspace) |
| Prepackaged Assembly | Reference a DLL included with the OneStream installation |
| Business Rule | Reference a business rule from the Business Rules page |
Same Workspace, Different Maintenance Unit
- Select Workspace Assembly as the dependency type
- Enter the Dependency Name (the assembly name)
- Leave the Shared Workspace Name property empty — do not fill it in when referencing within the same workspace
- Click Save
Different Workspace
- Select Workspace Assembly as the dependency type
- Enter the Dependency Name (the assembly name)
- In the Shared Workspace Name property, enter the name of the workspace that contains the target assembly (multiple workspace names can be entered as a comma-delimited list)
- The target workspace must have
Is Shareable Workspace = True - Click Save
Referencing Syntax
General Pattern
The fully qualified reference syntax is:
Where:
- WorkspaceName — the name of the workspace (or
Currentfor the current workspace) - AssemblyName — the name of the assembly
- FileName — the name of the specific file within the assembly
Using the Current Keyword
You can use
Current in place of the workspace name to refer to the workspace containing the current object. This makes configurations more robust since references won't break if the workspace is renamed or duplicated.Syntax by Business Rule Type
XFBR (String Functions)
Standard (Business Rules page):
Assembly version:
Example:
Dashboard Extender
Standard:
Assembly version:
Dashboard DataSet
Standard:
Assembly version:
Spreadsheet
CubeView Extender
Set the custom report task to "Execute CubeView Extender Business Rule" and reference using:
Finance Business Rules (Cube Properties)
Reference from Cube Properties > Business Rules:
Service Factory References
Service Factories can be referenced from configuration properties using these shorthand patterns. For a full overview of the Service Factory pattern, see Getting Started with Workspace Assemblies.
| Syntax | Behavior | Can Be Used On |
|---|---|---|
assemblyName.factoryName | Looks for factoryName in the specified assembly | Maintenance Unit, Workspace |
WSMU | Looks at the Maintenance Unit first, then falls back to the Workspace | Dashboard Components |
WS | Looks at the Workspace level only | Dashboard Components |
Current | References the same Maintenance Unit containing the step | Data Management Steps |
Explicit Reference (for CubeViews, Cube Properties, etc.)
Example — referencing a MemberList parameter from a CubeView:
Example — referencing a GetDataCell function:
Best Practices
- Keep assemblies in a single Maintenance Unit when possible to simplify management
- Use the
Currentkeyword when referencing items within the same workspace to make your configuration more portable and resilient to renames - Always set
Is Shareable Workspace = Trueon any workspace you plan to reference from other workspaces - Use explicit syntax in CubeViews — they always require the full
Workspace.Name.MU.WSMUpath, even for same-workspace references - Avoid duplicate names between the Default workspace and custom workspaces, since the Default workspace can see all shareable workspaces
- Security: You must be part of the Administer Application Workspace Assemblies security role to edit assemblies
Quick Reference Table
| Scenario | Dependency Setup | Reference Syntax |
|---|---|---|
| Same workspace, same MU | No dependency needed (same assembly) | Direct class/method call |
| Same workspace, different MU | Add Workspace Assembly dependency, leave Shared Workspace Name empty | Workspace.Current.AssemblyName.FileName |
| Different workspace | Add Workspace Assembly dependency, set Shared Workspace Name, source must be Shareable | Workspace.OtherWorkspaceName.AssemblyName.FileName |
| From a Business Rule (BR page) to an assembly | Add assembly as Referenced Assembly on the BR | Workspace.WorkspaceName.AssemblyName (prefix starts with Workspace.) |
| In-code class reference (within assembly code) | Add Workspace Assembly dependency (same as above scenarios) | Workspace.{NamespacePrefix}.{AssemblyName}.{ClassName} or use Imports/using |
Related Content
- Referencing Dependency Classes in Code — Compiled namespace pattern, Imports/using directives, and cross-assembly class references
- Getting Started with Workspace Assemblies — Workspace hierarchy, assembly structure, and the Service Factory pattern
- Getting Started with Business Rules — Business Rules fundamentals for comparison