
C Sharp Scripting
Writing and executing C# scripts and macros against Power BI semantic models using...
Install
npx skills add data-goblin/power-bi-agentic-development --skill c-sharp-scripting -g -a claude-code -y- Repository
- data-goblin/power-bi-agentic-development1.1k
- Category
- Writing
- Updated
- 5d ago
- License
- GPL-3.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- Yes, review before use
What it does
Writing and executing C# scripts and macros against Power BI semantic models using Tabular Editor 2/3. Automatically invoke when the user mentions "C# script", "Tabular Editor script", "TOM scripting", "MacroActions.json", "XMLA", or asks to "automate model changes", "bulk update measures", "create calculation groups", "write a macro", "format DAX expressions", "manage model metadata".
C# Scripting for Tabular Editor
Expert guidance for writing and executing C# scripts to manipulate Power BI semantic model metadata using Tabular Editor 2/3 CLI or the Tabular Editor IDE.
When to Use This Skill
Activate automatically when tasks involve:
- Writing C# scripts for Tabular Editor
- Bulk operations on model objects (measures, columns, tables)
- Creating or modifying calculation groups
- Managing model security (roles, RLS, OLS)
- Formatting DAX expressions
- Automating repetitive model changes
- Querying model metadata via TOM API
- Building interactive scripts with user input dialogs
Critical
- Every statement must end with
;(semicolon required by C#) - Use double quotes
"for strings and escape with\when needed - Use forward slashes
/in DisplayFolder paths (auto-converted to\) - Always add
Info()statements for debugging - script stops at error point - Test scripts on non-production models first
- Changes are undoable with Ctrl+Z in the Tabular Editor UI
C# Version Support
| Environment | C# Version | Notes |
|---|---|---|
| Tabular Editor 2 | Default compiler | Older C# syntax |
| Tabular Editor 3 | Roslyn | Supports up to C# 12 with VS2022 |
| TE2 with Roslyn | Configurable | Set in File > Preferences > General |
To use newer C# features in TE2, configure Roslyn compiler path in preferences.
Default Imports and Assemblies
Auto-Imported Namespaces
Scripts automatically have these using statements applied:
using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using TabularEditor.TOMWrapper;
using TabularEditor.TOMWrapper.Utils;
using TabularEditor.UI;
Pre-Loaded Assemblies
These .NET assemblies are loaded by default:
