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

You can run a local copy of Turnkey from Visual Studio to debug the Turnkey server and override application pages while it uses your model and data in the cloud.

Choose the right development approach

Use this procedure when you need to run the Turnkey server locally in Visual Studio. It is intended for debugging Turnkey behavior or changing a Turnkey page locally.

Your goal Use this approach
Debug a local Turnkey server against the cloud model and data Follow this page.
Add C# code and .cshtml pages to a Turnkey application without setting up local Turnkey debugging Use CodeDress.
Create a separate .NET application that uses an MDriven model Use HowTos:How To Create a .NET Core MDriven Project.
Move an existing model-development workflow from MDriven Designer to Visual Studio Use HowTos:Switching to Visual Studio from MDrivenDesigner.

Before you start

You need the following:

  • Visual Studio.
  • A downloaded and extracted MDriven Turnkey application archive.
  • Access to the cloud-hosted MDrivenServer that holds the model and data you want to use.
  • The correct .NET Framework version selected for the downloaded Turnkey application.

This workflow uses the downloaded application locally but connects it to the cloud model and data. It does not create a separate local model or database.

Download and extract Turnkey

  1. Download the current MDriven Turnkey archive from the MDriven download site.
  2. Extract the archive to a local development folder.
  3. Locate the extracted Application folder. You open this folder as a web site in Visual Studio.

Keep the extracted folder intact. The configuration files and the Views folders described later must remain in their expected locations.

Open Turnkey as a web site in Visual Studio

  1. Start Visual Studio.
  2. Select OpenWeb Site.
  3. Select the extracted Application folder.
  4. In Solution Explorer, select the Application project.
  5. Open the Properties window and enable SSL.
  6. Copy the SSL URL shown for the application.
  7. In Solution Explorer, right-click Application and open its start options.
  8. Paste the copied SSL URL into the Start Url field.
  9. Confirm that the project is configured to build with the .NET Framework version required by the downloaded Turnkey application.

Using the SSL URL as the start URL makes Visual Studio start the local application at the same HTTPS address that SSL configuration provides.

Connect the local application to the cloud model and data

The extracted Turnkey application includes inactive override configuration files. Activate them to make the local application use your cloud configuration.

  1. In the application files, locate MDrivenServerOverride - NotInEffect.xml.
  2. Rename it to MDrivenServerOverride.xml.
  3. Locate TurnkeySettings - NotInEffect.xml.
  4. Rename it to TurnkeySettings.xml.
  5. Set the connection information in the activated configuration files so the local application connects to the intended cloud MDrivenServer, model, and data.
  6. Build the application.
  7. Start debugging from Visual Studio.

The suffix - NotInEffect prevents these settings from being used. Renaming the files activates the local override settings. Do not leave both an inactive filename and an active filename unclear in source control; the local application reads the active filenames above.

Verify the connection

Start the application under the debugger and open the configured HTTPS start URL. Confirm that the application displays the expected cloud-backed model and data before you begin changing views or debugging code.

If the expected model does not appear, review the active MDrivenServerOverride.xml and TurnkeySettings.xml files and verify that you are using the intended cloud environment.

Override a Turnkey page

A ViewModel defines a view and its behavior. You can replace the rendered page for an existing ViewModel by placing a Razor .cshtml file in the Turnkey override folder.

  1. Identify the exact name of the ViewModel whose page you want to replace.
  2. In Solution Explorer, open ViewsEXT_OverridePages.
  3. Create a new .cshtml file in EXT_OverridePages.
  4. Name the file exactly after the existing ViewModel.
  5. Copy the starting markup from ViewsTurnkeyAngularPageDynamicTemplate.cshtml into the new file.
  6. Modify the copied page.
  7. Build and debug the application, then open the ViewModel page to verify the override.

For example, to override a ViewModel named TimeManage, create this file:

Views/EXT_OverridePages/TimeManage.cshtml

The file name must match the ViewModel name exactly. A file named TimeManageOverride.cshtml does not override TimeManage.

The template gives you a starting point for the standard dynamic Angular page. When you need to control rendering with HTML5 and Angular bindings, begin with that template and adapt it for the ViewModel you are overriding.

Debugging workflow

Use this repeatable loop while developing locally:

  1. Make a configuration, code, or page-override change.
  2. Build the application in Visual Studio.
  3. Start debugging.
  4. Navigate to the affected ViewModel in the local HTTPS application.
  5. Trigger the behavior you are investigating and use Visual Studio breakpoints to inspect execution.
  6. Verify both the local rendering and the cloud-backed data behavior.

For general Turnkey debugging guidance, see HowTos:Debug Turnkey Generic Code.

Common issues

Symptom Check
The browser does not start at the local HTTPS application Enable SSL for Application, copy its SSL URL, and set that URL as the project's Start Url.
The application does not use the intended cloud model or data Confirm that MDrivenServerOverride.xml and TurnkeySettings.xml are active and contain the intended cloud connection settings.
A custom page does not replace the standard page Confirm that the file is in Views/EXT_OverridePages, has the .cshtml extension, and matches the ViewModel name exactly. For example, TimeManage requires TimeManage.cshtml.
The application fails to build after opening it Check that the project uses the .NET Framework version required by the downloaded Turnkey application.
A model file does not open correctly in Visual Studio Follow HowTos:Fix Visual Studio Not Opening Model File.

See also