Visual Studio for F&O: Projects & Models
Set up F&O development in Visual Studio β create projects, manage models and packages, explore the AOT, synchronise databases, and debug code.
Visual Studio for F&O: Projects & Models
Visual Studio is the IDE for all F&O development. This module covers your daily workflow: creating projects, managing models and packages, navigating the Application Explorer, syncing the database, and debugging.
Think of Visual Studio as your workbench, and models as your toolboxes.
Visual Studio is where you write code, design forms, and build tables. A model is like a labelled toolbox β it holds all your custom elements (tables, classes, forms) for a specific purpose. A package is a sealed shipping box β when you deploy your work, Visual Studio compiles your model into a deployable package. The Application Explorer is the warehouse inventory β it shows every element in the entire F&O system, organised in a tree structure.
Models and Packages
Models β your code containers
A model is a logical grouping of elements that belong together. Every element in F&O belongs to exactly one model.
| Concept | What It Is | Analogy |
|---|---|---|
| Model | A logical container for your custom elements | A labelled toolbox |
| Package | A compiled, deployable unit (one or more models) | A sealed shipping box |
| Module | A functional area (Finance, Supply Chain, etc.) | A department in the company |
π Sophie setting up her first project: βCarl walked me through model creation. We created a model called βFerrisExtensionsβ in the βFerrisIndustriesβ package. He explained: βYour model name should be unique β include your company name. Never add elements directly to Microsoftβs models.ββ
Creating an extension model
- Open Visual Studio β Dynamics 365 menu β Model Management β Create model
- Choose a name (e.g.,
ContosoExtensions), publisher, and layer - Select βCreate new packageβ or βAdd to existing packageβ
- Choose referenced packages (the models you depend on β ApplicationSuite, ApplicationPlatform)
- Set the model as your default for new elements
Exam tip: Models vs packages
The exam distinguishes models from packages. A model is a DESIGN-TIME concept (where elements live in source). A package is a DEPLOYMENT-TIME concept (what gets compiled and shipped). One package can contain multiple models, but a model belongs to exactly one package. Questions about deploying code = packages. Questions about organising elements = models.
Application Explorer (AOT)
The Application Explorer displays the full Application Object Tree β every table, class, form, and element in the system.
Tree structure
| Node | What It Contains |
|---|---|
| Data Model | Tables, views, queries, EDTs, enums, maps, data entities |
| User Interface | Forms, menus, menu items, tiles |
| Code | Classes, macros, jobs |
| Business Process and Workflow | Workflow types, categories, approval elements |
| Analytics | Reports, SSRS designs, KPIs |
| Services | Service classes, service groups |
| Security | Roles, duties, privileges, policies |
| Resources | Images, files, labels |
Working with Application Explorer
- Search β Use the Application Explorer search box or navigate the tree. Filter by model to narrow scope
- Filter by model β show only elements from a specific model
- Right-click > Properties β view element metadata (table group, cache policy, etc.)
- Right-click > Add to project β add an element to your current project for editing
- Right-click > Create extension β create an extension of a Microsoft element in your model
Database Synchronisation
When you add or modify tables, fields, or indexes, you must synchronise the database to apply changes.
How to sync:
- Full sync: Build menu β Synchronize database (syncs all models)
- Project sync: Right-click project β Synchronize database (syncs only your project)
The sync process compares the metadata (what you designed) to the actual database schema and generates ALTER TABLE statements to bring them in line.
ποΈ Vikβs warning: βNever skip the database sync after adding fields or tables. If your metadata says a field exists but the database does not have it, you get runtime errors. I sync after every build β it takes seconds and saves hours of debugging.β
Element Designers
Visual Studio provides graphical designers for each element type:
| Designer | Used For | Key Features |
|---|---|---|
| Table designer | Tables, fields, relations, indexes | Add fields, define relations, set properties |
| Form designer | Forms and form controls | Drag-and-drop UI layout, data source binding |
| Class designer | X++ classes | Code editor with IntelliSense |
| Report designer | SSRS reports | Visual layout, data sources, parameters |
| Data entity designer | Data entities | Backing table, field mapping, staging |
Debugging
Visual Studio provides a full debugger for X++ code.
Setting breakpoints and stepping through code
- Open the X++ file and click the left margin to set a breakpoint
- Attach to the AOS process (Debug β Attach to Process β w3wp.exe)
- Trigger the code path in the F&O client
- Visual Studio breaks at your breakpoint
- Use Step Over (F10), Step Into (F11), and Step Out (Shift+F11)
- Inspect variables in the Locals, Watch, and Call Stack windows
| Window | Shows | Use For |
|---|---|---|
| Locals | All variables in the current scope | Quick inspection of nearby values |
| Watch | Variables you explicitly add | Tracking specific values across steps |
| Call Stack | The chain of method calls that led here | Understanding how you got to this point |
| Immediate | Execute expressions on the fly | Testing values and evaluating expressions |
| Output | Build and debug messages | Checking for warnings and errors |
Sophie creates a new model for Ferris Industries. She wants to extend the CustTable with a custom field. Which approach is correct?
After adding a new field to a table extension, Vik's code throws a runtime error saying the field does not exist. What did he forget?
Next up: Source Control, Builds & CI/CD β version control with Azure DevOps, branching strategies, and automated build pipelines.