次の方法で共有


Create a project from items checked out with the version control

I regularly install a new build of AX, so I have to export and import the stuff I'm working on. I have written the following job to help me create a Private Project of whatever is checked out.

 static void SysCreatePendingObjectsProject(Args _args)
{
    Dialog                      dialog;
    DialogField                 dialogFieldProjectName;
    SysProjectFilterRunBase     upgradeProject;
    SysVersionControlTmpItem    item;
    TreeNode                    treeNode;
    UtilElements                utilElements;
    void createProject(SysElementName   _projectName)
    {
        ProjectNode upgradeNode;
        upgradeNode = SysTreeNode::createProject(_projectName);
        upgradeProject = new SysProjectFilterRunBase();
        upgradeProject.parmProjectNode(upgradeNode);
        upgradeProject.grouping(SysProjectGrouping::AOT);
    }
    void getCheckedOutItems()
    {
        item = versioncontrol.getCheckedOutItems();
    }
    void addItems()
    {
        while select item
            where item.ItemPath != ''
        {
            if (SysVersionControlTmpItem::isTreenode(item.InternalFilename))
            {
                treeNode  = TreeNode::findNode(item.ItemPath);
                utilElements = xUtilElements::findTreeNode(treeNode, false);
                upgradeProject.doUtilElements(utilElements);
            }
        }
    }    ;
    dialog = new Dialog();
    dialogFieldProjectName = dialog.addField(typeId(SysElementName));
    if (dialog.run())
    {
        createProject(dialogFieldProjectName.value());
        getCheckedOutItems();
        addItems();
        upgradeProject.write();
    }
}

There is one catch with this job though. It doesn't include the new elements I haven't "Created" yet, which is a bit of a problem if that is something you tend to forget. It's on my to-do list.

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm

Job_SysCreatePendingObjectsProject.xpo

Comments

  • Anonymous
    March 04, 2007
    I worry about casting a shadow to standard when creating new objects. I wonder if there is a simple way to add methods, fields and other elements to standard objects by writing them to AOT with a job. This would be a great help in Ax upgrades and rollouts. Your project above enlights the solution to my worry.

  • Anonymous
    March 04, 2007
    We have a couple of examples on code adding objects to the AOT, for example the financial dimensions wizard (class SysDimensionAddWizard). If you update your cross reference and look at the TreeNode class you can find more exsamples. Also take a look at these upcomming tools: http://blogs.msdn.com/mfp/archive/2007/03/02/sneak-preview-code-upgrade-enhancements.aspx

  • Anonymous
    April 01, 2007
    A job that could list new objects that are not created would be very welcome :) Btw. are you using tools like nant and CruiseControl to monitor your Dynamics builds ?

  • Anonymous
    April 01, 2007
    No, we are not using any of these tools to monitor the builds. I'm told that we use "BuildTracker" for some of our branches.

  • Anonymous
    April 01, 2007
    It seems like you have to travere the entire AOT to find the elements that should be "created". For each treenode a call to ClassesVersionControlallowCreate would tell you if this is a treenode not allready in the version control.

  • Anonymous
    April 09, 2007
    Uh nice :) will have to implement a job for this. We use CruiseControl.Net to monitor our dynamics - and many other - builds. We = SPI-Tools at Systematic i århus :)

  • Anonymous
    April 09, 2007
    The comment has been removed