🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
First MDriven Framework project
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

You can create and run a starter MDriven Framework desktop application in Visual Studio to verify that the MDriven Framework templates are installed and working.

Before you begin

Install MDriven Framework in Visual Studio. You should be able to create a new project and find the MDriven Framework/ECO templates in the Create a new project dialog.

This page is for a first WPF (Windows Presentation Foundation) desktop application. It is not the workflow for an MVC application, a .NET Core project, or for moving an existing model from MDriven Designer.

Create the starter project

  1. Start Visual Studio.
  2. Select Create a new project.
  3. Find the MDriven Framework project templates. If the templates are not available, verify that MDriven Framework is installed in Visual Studio before continuing.
  4. Select the WPF Windows application template.
  5. Enter a project name and choose a location.
  6. Select Create.

Visual Studio creates a starter solution containing a model-driven WPF application. The generated project is intended to compile and run without first adding your own model classes or UI.

Build and run

  1. In Visual Studio, select Build > Build Solution.
  2. Confirm that the build completes with no errors.
  3. Press F5 to start debugging.
  4. Confirm that the starter WPF application window opens.

A successful build and application window confirm that Visual Studio can create, compile, and run an MDriven Framework WPF project.

What to do next

After the starter application runs, choose the path that matches your goal:

Goal Next step
Use a model you already created in MDriven Designer Follow Documentation:Moving your work from MDriven Designer to MDriven Framework. That workflow imports the model, updates generated code, adds the required references to a WPF application, and initializes the EcoSpace.
Move ongoing model work to Visual Studio Follow HowTos:Switching to Visual Studio from MDrivenDesigner. When model structure changes, run Codegen; build the project before uploading so the current build is used for CodeDress.
Create a .NET 6 or later project Follow HowTos:How To Create a .NET Core MDriven Project. This uses an .ecomdl model, NuGet packages, Codegen, and the model's Assets_TK folder.
Start an MVC application Follow HowTos:Getting started template for MDriven MVC.
Build a WinForms application See Documentation:WinForms MDrivenFramework.

Key terms

  • MDriven Framework is the Visual Studio-based MDriven development approach that generates C# code from your model.
  • An EcoSpace is the runtime object used to work with the model. In a WPF application based on an imported model, you instantiate and activate the EcoSpace before connecting the UI to it.
  • Codegen generates C# files for model classes. Run it after changes that affect model structure, such as classes, associations, or state machines.
  • CodeDress lets you complement generated model classes with C# code. Generated classes are partial classes, so code kept in separate files is not overwritten by framework generation.

Troubleshooting

The MDriven Framework templates do not appear

Confirm that MDriven Framework is installed in the Visual Studio instance you started. The templates must be available before you can create this starter project.

The starter project does not build

Build the solution and review the Visual Studio error list. Do not continue to model import, code generation, or deployment until the unmodified starter project builds successfully; this first build is the baseline for checking the installation.

You already have a model

Do not recreate the model in the starter project. Use Documentation:Moving your work from MDriven Designer to MDriven Framework to import it, or HowTos:Switching to Visual Studio from MDrivenDesigner for the Visual Studio model workflow.

See also

Create and run a first MDriven Framework project

Create and run a first MDriven Framework project

Start your first MDriven project in Visual Studio.

  1. Choose the WPF Windows application.
  2. Create the project.
  3. Build and run it.

The source states that the resulting project should compile and run as created.

Related resources

First MDriven Framework project

Use this guide to create and run your first MDriven Framework WPF application in Visual Studio; it is for developers who have a model in MDriven Designer and want explicit C# code for its model classes.

Before you begin

You need Visual Studio with MDriven Framework installed. Confirm that the ECO7 templates are available when you create a new Visual Studio project.

Prepare a model to import. If your model was created in MDriven Designer, save it in the format required for import before starting this procedure.

Create the solution

  1. Start Visual Studio.
  2. Create a new project from the EcoProject1 template.
  3. Add another project to the same solution by using the standard WPF Application template.
  4. Open the model file in the EcoProject1 project.

The EcoProject1 project contains the model and its MDriven Framework support. The WPF project is the application that displays the model-driven user interface.

Import your model

  1. In the Modlr Toolbox window, right-click the Packages note.
  2. Select Import.
  3. Select the model from your MDriven Designer work and import it.
  4. Remove any package supplied by the template that you do not need.
  5. On the Modlr surface, select Update Code.
  6. Build the complete solution.

For example, if you imported a model that contains a Person class, the generated code represents that class in the Framework project after you update code and build.

Add the model package to the EcoSpace

Add the imported package to the EcoSpace in the EcoProject1 project. An EcoSpace is the runtime object that provides access to your model.

Then add a reference from the WPF project to the EcoSpaceAndModel project. Also add the required ECO assemblies to the WPF project:

  • Eco.Handles
  • Eco.Interfaces
  • Eco.LinqExtender
  • Eco.WPF
  • WecpofLogic

Show the model in the WPF window

Use WECPOFTabBased to give the WPF application an initial model-driven user interface comparable to the prototyper in MDriven Designer.

  1. Open MainWindow.xaml in the WPF project.
  2. Replace the window content with the following markup. Change WpfApplication2 if your WPF project uses a different namespace.
<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wecpof="clr-namespace:WECPOFLogic;assembly=WECPOFLogic"
        Title="MainWindow" Height="350" Width="525" >
    <Grid>
      <wecpof:WECPOFTabBased x:Name="wECPOFTabBased">
            </wecpof:WECPOFTabBased>
    </Grid>
 </Window>
  1. Open MainWindow.xaml.cs.
  2. Add the EcoSpace field and initialization code shown below. Replace EcoProject1EcoSpace with the EcoSpace class generated for your project.
public partial class MainWindow : Window
{
    EcoProject1EcoSpace _es;
    public MainWindow()
    {
      InitializeComponent();

      _es=new EcoProject1EcoSpace(); // Instantiate your EcoSpace
      _es.Active = true;
      // Turn on AsyncLoading so that UI never locks up while loading/saving
      EcoServiceHelper.GetAsyncSupportService(_es).TurnOnAsyncHandling();
      // Let WECPOF know about our EcoSpace
      wECPOFTabBased.EasyInit(_es);

      this.Closing += MainWindow_Closing;
      this.Closed+=MainWindow_Closed;
    }

    void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
      // Disable quit if there are unsaved changes
      e.Cancel = _es.DirtyList.AllDirtyObjects().Count > 0;
    }

    void MainWindow_Closed(object sender, EventArgs e)
    {
      // Turn off the EcoSpace on quit to gracefully end the application
      _es.Active = false;
    }
}

The closing handler prevents the application from closing while the EcoSpace has unsaved changes. The closed handler deactivates the EcoSpace when the application ends.

Build and run

  1. Build the solution and resolve build errors before running it.
  2. Press F5 to compile and start the WPF application.
  3. Verify that the application opens and that the model-driven interface is shown.

If the application does not compile, first check that the WPF project references the EcoSpaceAndModel project and the required ECO assemblies. Also check that the EcoSpace class name in MainWindow.xaml.cs matches the class generated by your project.

Continue development

After the first application runs, you can change WPF styles, add content overrides for your own controls, or generate code for ViewModels. When you move an existing model into Visual Studio, follow Moving your work from MDriven Designer to MDriven Framework.

See also