web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / DAXRunBase / Team Foundation Server and ...

Team Foundation Server and AX labels

Vilmos Kintera Profile Picture Vilmos Kintera 46,149
Today we will cover the topic of using labels with the Team Foundation Server (TFS) as our Microsoft Dynamics AX Version Control System (VCS).

If you set up a new environment from scratch and your repository is empty, you can import your existing ALD label files to AX and add it to VCS in 2 easy steps.

1) You may use the standard "ALDImport" startup command with the AX client and pass in your labels one by one, or use the following code to import all files from a specific folder with the help of dotNET managed code:
static void WIK_ImportLabelFromFolder(Args _args)
{
#AOT

SysLabelFile labelFile;
Set languages = new Set(Types::String);
System.Array fileList = System.IO.Directory::GetFiles(@"C:\TEMP\", "*.ald");
Filename fileName;
int i;

for (i = 0; i < CLRInterop::getAnyTypeForObject(fileList.get_Length()); i++)
{
fileName = CLRInterop::getAnyTypeForObject(fileList.GetValue(i));
info(fileName);
labelFile = sysLabelFile::newFilename(fileName);
languages.add(labelFile.parmLanguageId());

if (!Treenode::findNode(strfmt(#LabelFileLanguagePath,
labelFile.parmModuleId(),
strReplace(labelFile.parmLanguageId(), '-', '_'))))
{
SysLabelFile::createLabelFileInAOT(labelFile.parmModuleId(), languages);
}

labelFile.importAldFile(fileName);
}
info("Done");
}

2) Once you have your labels in the AOT, you have to dump all the languages within that label node to the TFS repository, which would be the axWIKEN-US.ALD file in my case:
static void WIK_AddLabelToVCS(Args _args)
{
#AOT
#define.LanguageModuleId('WIK')

TreeNode node;
SysLabelFile labelFile;
TreeNodeTraverser tnt = new TreeNodeTraverser(
TreeNode::findNode(strFmt(#LabelFileLanguagesPath,
#LanguageModuleId)).AOTfirstChild());
SysVersionControlSystem vcs = versioncontrol.parmSysVersionControlSystem();

node = tnt.next();

while (vcs && node)
{
labelFile = SysLabelFile::newLanguageModule(
strReplace(node.AOTname(), '_', '-'), #LanguageModuleId);
vcs.commandAdd(labelFile);

node = tnt.next();
}
}

Comments

*This post is locked for comments