How To Create A D365 Project In Visual Studio

Share this:

Whenever a developer needs to add code in Microsoft Dynamics 365 for Finance and Operations, the first step is to create a project. In this article I wanted to explain the steps of how to create a D365 Project in Visual Studio. And some of the key pieces to be aware of. In the future articles, I can reference this article, instead of including the same steps on every article.

Create A D365 Project

A D365 project tells Visual Studio what type of code you are writing. And allows Visual Studio to compile and check the syntax of the code accordingly. Follow these instructions to create a project.

First, open Visual Studio, running as an administrator.

Next, create a new D365 project. To do this, go to File>New>Project.

Visual Studio 2017

Select the ‘Dynamics 365’ section from the left, then select the ‘Finance and Operations’ project type.

Enter in a Name for the project and solution name. Then click ‘Ok’. If you are using Visual Studio 2017, your screen will look like this.

The solution and project will be created, and shown in the Solution Explorer window.

Visual Studio 2019

In Visual Studio 2019, the dialog screens for creating a project look different than before.

When the dialog from opens, enter the text ‘Finance operations‘ in the top search bar. Then select the ‘Finance Operations‘ node from results in the grid. Finally, click the ‘Next‘ button.

There is an alternative option as well. When the previous dialog form opens, you may see ‘Finance Operations‘ node under ‘Recent project templates‘. This will only show if you have previously opened a project of this type. If you see this node, you can select it and then click the Next button.

After clicking the ‘Next‘ button, a second dialog form will be shown. Enter a value for the ‘Project’ name‘. Validate that the rest of the settings are what you want. Otherwise, change them to be different than their default values. In this example, I entered ‘MyProjectName’ and the solution name will default to to the same name. Finally, click the ‘Create‘ button.

The solution and project will be created, and shown in the Solution Explorer window.

D365 Project Properties

After creating the Solution and D365 Project in Visual Studio, there are some important properties to set.

Model Property

First, the ‘Model’ property tells the system which model the code should be stored in. To better understand what a Model is, please see my article: how to create a Model In D365. Additionally, you can see the Microsoft documentation here.

Right click on the Project node and set the ‘Model’ property to your model.

Synchronize Database On Build

Additionally, if you plan to create or change any object that would affect the database, please set the ‘Synchronize Database on Build‘ property to True. By default, this property is set to False.

When a Build is run on the Project, the system will synchronize the objects in the project with the objects in the SQL database. This is needed if, for example, you created a table. Or you created a Data Entity. Likewise, if you added a field to a table. Or changed a property on an Extended Data Type that affected the length of a string field. All of these things require the SQL database to change to match. And the ‘Synchronize Database on Build‘ property must be set to true in order for the system to update the SQL database.

Sometimes, a developer might leave the ‘Synchronize Database on Build’ property set to False. And then perform a ‘Synchronize Database’ later. The reason for doing this is to speed up how quickly it takes to Build the code in the Project.

For example, if a developer is writing a lot of x++ code, and wants to regularly build their project to make sure it compiles. It could be faster to have this property turned off. And then later run a Synchronize Database once the rest of the code has been written.

Finally, click the ‘Ok‘ button on the D365 Project properties dialog form.

Create New Items

After creating a D365 project, you need to add items to the project. To create new items, right click on the project and select Add>New Item.

Next, in the dialog that opens, select the ‘Dynamics 365 Items‘ from the left side, then pick a type of object to add from the list. Then, enter in a Name. Then click the ‘Add’ button.

A new object of the type you selected will be added to the Solution Explorer. You can double click on it to open a designer or code editor window. Right click on the node and select Properties to see and edit the properties on the node.

Add Existing Items To The Project

Instead of creating new items, often times, you need to modify an existing item. There are two ways of doing this.

Extend An Item

First, if the object is not part of your model, you must extend the Item. To do that, first open the Application Explorer. If it is not already open, go to View>Application Explorer.

Secondly, search for the item you wish to modify and select it.

Thirdly, right click on the node, and select ‘Create Extension’.

Note, this option will only exist when the object is part of a different Model than your Project. You can tell what Model the object exists in by looking at the name between the square brackets just to the right of the name of the node. In this screenshot, see that CustTable is part of the model ‘Application Suite‘. Our D365 Project Model property is set to ‘dynamics365musings’. Which we can see by looking to the right of the name of our project in the Solution Explorer.

Therefore, we need to ‘extend’ the CustTable object, instead of simply add it to our Project.

Add Items That Are Part Of The Project Model

The second way of adding existing items to your project is when the item is part of the same model as your project.

In my environment, I have a table named ‘rsmVehicle’ which is part of the ‘dynamics365musings’ model. When I right click on the node, I see the option to ‘Add to project’.

After taking this action, a node is added to my project. I can then double check on it to open it in the designer. And modify the item from there.

Summary

In this article, you learned how to create a D365 Project in Visual Studio. You also learned the key properties that you always need to set after creating a project. After that, you learned how to create new items that will be added to the project. Finally, you learned how to add existing items to the project. Either by extending an object that is part of a different Model. Or by adding an object that is part of the same Model as your Project. These steps are crucial for any developer in Microsoft Dynamics 365 for Finance and Operations.

Peter Ramer
Peter Ramer is a part of the Managed Application Services team at RSM working on Microsoft Dynamics 365. He focuses on the Retail and Commerce industries. When he is not solving problems and finding ways to accelerate his clients' business, he enjoys time with his three kids and amazing wife.

Share this:

10 thoughts on “How To Create A D365 Project In Visual Studio

Add yours

    1. Yes. You are correct. The tutorials I wrote months ago used the model rsmTutorials. I decided to change it and use dynamics365musings going forward.
      You can use whatever you are comfortable with. It is easiest to just use one model if you can.

  1. Hi Peter How can we implement our X++ customizations on sandbox and production environment.. Is this possible via azure only or something else… Please give some clarification video for that thanks…

    1. Yes, you must develop all customizations in an azure cloud hosted environment. Then build a package using a build server. Then apply that package to a sandbox, test or stage environment. Then that package can be scheduled to be promoted to the production environment.

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑