Monday, April 30, 2012

Changing a Model Name When Using TFS on AX 2012

One of the challenges we recently faced was renaming a model on an AX 2012 system that is hooked up to TFS. As it turns out, it's not a big deal, really.


1. Make sure everyone is off the system, shutting down the AOS may be a good idea too.

I'm not certain how much trouble you would be in changing the model while the AOS is running or someone is on the system, but at the very least you want to avoid issues with the TFS paths.


2. Rename the model folder in TFS (optional).

Open up Visual Studio, browse to the model folder in source control and rename the model folder. Now, keep in mind that technically the name of the folder in TFS does not have to match the name of the model (although I find it much more intuitive of course).


3. Edit the model.xml file in TFS to reflect the new name.

I'm not entirely certain what AX uses the model manifest for after it's been created, but we use it in our build scripts, and it's probably just good bookkeeping to changing the name everywhere.


4. Edit the vcsdef.xml.

the vcsdef.xml file resides in the Definition folder of your source control tree, and maps model names to folders in your source control. This comes back to the point that the folder name does not necessarily have to match the name of the model. The vcsdef.xml file has a node where you will see your models and folders listed.


5. Use AxUtil or the powershell cmdlets to change the name property of your model.

Using AXUTIL:
axutil edit /model:MYMODEL /manifest:Name=MyModelNewName

Using PowerShell:
Edit-AXModelManifest -Model MYMODEL -Property "Name = MyModelNewName"

Optionally you can also used the updated model manifest file to update the model store to the new name.


6. Make sure you pull all the updated TFS stuff into your local AX workspace.

Depending on where you launched Visual Studio to make the changes, and depending what workspace you were using there, the vcsdef.xml file (and new folder name, model.xml, etc) may not be updated in the repository that your AX client is using. Make sure you pull the latest changes down!


7. Restart AOS and AX 2012 won't realize anything happened at all.

Log into AX and you shouldn't have any problems with your renamed model.

3 comments:

  1. Hi Joris,
    Does the above apply when each developer has their own VM and is connected in to TFS?
    Thanks
    Ryan

    ReplyDelete
    Replies
    1. Sure, remember that any of the steps that say "AOS" or "AX Workspace" need to be done on each VM. I believe that Martin Drab has some info about renaming also, on his blog at http://dev.goshoom.net/en/ - you'll have to search for it tho.

      Delete