Domain 2 β€” Module 1 of 2 50%
4 of 28 overall
Domain 2: Apply Developer Tools Free ⏱ ~15 min read

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.

Simple explanation

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.

ConceptWhat It IsAnalogy
ModelA logical container for your custom elementsA labelled toolbox
PackageA compiled, deployable unit (one or more models)A sealed shipping box
ModuleA 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

  1. Open Visual Studio β†’ Dynamics 365 menu β†’ Model Management β†’ Create model
  2. Choose a name (e.g., ContosoExtensions), publisher, and layer
  3. Select β€œCreate new package” or β€œAdd to existing package”
  4. Choose referenced packages (the models you depend on β€” ApplicationSuite, ApplicationPlatform)
  5. 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

NodeWhat It Contains
Data ModelTables, views, queries, EDTs, enums, maps, data entities
User InterfaceForms, menus, menu items, tiles
CodeClasses, macros, jobs
Business Process and WorkflowWorkflow types, categories, approval elements
AnalyticsReports, SSRS designs, KPIs
ServicesService classes, service groups
SecurityRoles, duties, privileges, policies
ResourcesImages, 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:

DesignerUsed ForKey Features
Table designerTables, fields, relations, indexesAdd fields, define relations, set properties
Form designerForms and form controlsDrag-and-drop UI layout, data source binding
Class designerX++ classesCode editor with IntelliSense
Report designerSSRS reportsVisual layout, data sources, parameters
Data entity designerData entitiesBacking table, field mapping, staging

Debugging

Visual Studio provides a full debugger for X++ code.

Setting breakpoints and stepping through code

  1. Open the X++ file and click the left margin to set a breakpoint
  2. Attach to the AOS process (Debug β†’ Attach to Process β†’ w3wp.exe)
  3. Trigger the code path in the F&O client
  4. Visual Studio breaks at your breakpoint
  5. Use Step Over (F10), Step Into (F11), and Step Out (Shift+F11)
  6. Inspect variables in the Locals, Watch, and Call Stack windows
Debug Windows Cheat Sheet
WindowShowsUse For
LocalsAll variables in the current scopeQuick inspection of nearby values
WatchVariables you explicitly addTracking specific values across steps
Call StackThe chain of method calls that led hereUnderstanding how you got to this point
ImmediateExecute expressions on the flyTesting values and evaluating expressions
OutputBuild and debug messagesChecking for warnings and errors
Question

What is the difference between a model and a package in F&O?

Click or press Enter to reveal answer

Answer

A model is a design-time container for elements (tables, classes, forms). A package is a deployment-time unit compiled from one or more models. You develop in models but deploy packages.

Click to flip back

Question

What is the Application Explorer?

Click or press Enter to reveal answer

Answer

The Visual Studio window that displays the full Application Object Tree (AOT) β€” every table, class, form, and element in the system, organised hierarchically. You use it to browse, search, and extend existing elements.

Click to flip back

Question

When must you synchronise the database?

Click or press Enter to reveal answer

Answer

After adding or modifying tables, fields, indexes, or any data model element. Sync compares your metadata to the actual database schema and generates ALTER statements. Without sync, runtime errors occur when code references elements that do not exist in the database yet.

Click to flip back

Knowledge Check

Sophie creates a new model for Ferris Industries. She wants to extend the CustTable with a custom field. Which approach is correct?

Knowledge Check

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.