There is a good explanation about how you can create a new model in a new package in the Wiki already. I want to talk about this a little anyway because I think I can add some useful information concerning package references and especially source control.
For the sake of completeness, I’ll include all steps, even though they’re in the Wiki already.
Have a good plan what your new package is aiming for. This should influence naming and must influence the references of and to it. The example I want to show is an extension model to Application Suite (in an extending package, of course) – aiming to include artifacts that extend objects from Suite (instead of overlayer / change / modify them).
How to do it – step by step
You need to use Visual Studio for the creation. Click Dynamics AX > Model Management > Create model… to open the dialog that allows you to.
In the second step you need to provide a name, the layer and some other information for your new model. The display name is used in the Application Explorer.
In the next step you can choose to create a new package (what is the choice in this example) or use an existing one. You need to use the second option if you want to do overlayering and pick the package in which the artifacts you want to modify reside. But obviously that is the old fashioned way of customizing AX 😉
Now it’s getting interesting because you need to pick the referenced packages (Select referenced packages). You can use – in code, for example – only objects that are known via references. Those references are not inherited, so don’t expect to be able to use Platform objects when you select only Suite as reference; you need to reference everything explicitly. In case of creating an extension model to Application Suite I suggest to use the same references Application Suite uses. Plus, Application Suite itself, of course. You can see the references when you open Dynamics AX > Model Management > Update model parameters…, I copy them manually from there. In some case you might want to reference Application Suite only – let’s say if you only want to create some form extensions of Suite forms.
In the final step of this dialog you usually want to keep the check mark in Create new project because assumingly you are creating a new model to be able to create objects and therefore you’ll need a project. When you’re about to work mainly on that model you’ll want to leave the check in Make this my default model for new projects as well. As far as I can see there’s no option for the default model in the options of VS but you can find the setting in the file C:\Users\Administrator\Documents\Visual Studio 2015\Settings\DynamicsDevConfig.xml:
axility Application Suite Extension
After confirming the dialog, the one for creating a new project appears. Give it a meaningful name. I put projects under version control, too, and so I select Add to source control usually. Of course you can do that later, too.
Speaking of source control. You surely want to check in the information about your new package and model so others can equip their environments with it (and automatic builds work properly etc.). Some things get created implicitly when you add any object that belongs to the new model because the folder structure determines that but you need to add one xml file manually: The descriptor file for the model that includes the reference settings and other information. You can right-click in the Source Control Explorer and select Add Items to Folder… to pick it. It’s in the Descriptor subfolder of the package and is named NameOfYourModel.xml. If there are several models in a package, you’ll find several xml files in that folder. After finishing the dialog, you should have an additional pending add for the file.
Next you might want to create the objects you needed the model for – I use an empty class as example.
Finally, you can check in everything using Team Explorer.