Skip to main content

Posts

Showing posts from December, 2025

How to embed PowerFX in NET app

How to embed PowerFX in a .NET Application PowerFX is a language from Microsoft aimed at power users. Writing PowerFX feels like Excel formulas, and one of the building blocks of PowerFX is actually “formulas” that are reactive to other formulas. Microsoft uses PowerFX mainly as the low code language for the PowerApps offering. A few years ago, Microsoft open sourced PowerFX with the goal of letting others take advantage of the power and simplicity of the language. The main repo is located at https://github.com/microsoft/Power-Fx . The repo contains a link nice introductory video about the what, why and how of PowerFX ( https://www.youtube-nocookie.com/embed/ik6k89WNjuk ). If you are a .NET developer, you too can take advantage of the power and simplicity of PowerFX by embedding a .NET PowerFX Interpreter created by Microsoft. One use case for embedding PowerFX in a .NET app is to allow Business Users to define Business Rules in PowerFX and then integrate them into your app. This all...

How to read build variables in Source Generators

How to read build variables in Source Generators I used GitHub copilot to help me create a source generator that reads the schema of a database and generates C# ADO.net code that can call SQL Stored Procedures, Views and Functions in that database ( https://github.com/TheJuanitoLearnsShow/Puppy.Ado.SourceGenerator ). The connection string to the database is set on a build variable in the consuming csproj file. The problem is that copilot missed the step described in Microsoft’s Source Generator Cookbook . The missing step is to add a CompilerVisibleProperty element to an ItemGroup for each of the build variables you want the source generator to use. For example, my source generator uses two build variables: DbGen_EnableLiveSchema and DbGen_ConnectionString, so they are defined in the PropertyGroup element in the consuming csproj file: <DbGen_EnableLiveSchema>true</DbGen_EnableLiveSchema> <DbGen_ConnectionString>Data Source=.\sqlExpress;Database=AutomatedTESTS_AdoGen...