VSTS Gated Check In Automated Build Fail

I have had my automated build working for some time now via a gated check in, so when code is checked in from Visual Studio, my AX7 code is automatically built. However, today I tried to check in and it failed on the “Get Sources” step with the error:

##[error]Exit code 1 returned from process: file name ‘tf’, arguments ‘vc unshelve Gated_2017-04-24_03.50.47.0723;rosie.jones@k3retail.com /loginType:OAuth /login:.,******** /noprompt’. Continue reading

Refreshing an AX7 development machine with changes from other developers

With Dynamics 365 for Operations (AX7), every developer must work on their own machine and share the work with others using Visual Studio Team Services (VSTS). This article shows how one developer can update his or her development machine with the developments made or hotfixes installed by other developers. This approach can also be used for other development-type environments.

These instructions may be quite obvious to someone with VSTS/TFS experience, but may be useful for AX developers who have used other techniques for previous versions of AX.

The below assumes that the developments to copy over are checked into VSTS. If you need to bring over incomplete developments that cannot be checked in yet, use the shelveset feature instead. See https://www.visualstudio.com/en-us/docs/tfvc/suspend-your-work-manage-your-shelvesets for reference on this approach.

1. Make sure the author of the development has checked in their completed work to VSTS

2. Log on to the target development machine, start Visual Studio and make sure it’s properly configured to run against the correct VSTS team project.
I have written a separate blog post about this.

3. Open Source Control Explorer (from View menu or from the Team Explorer window on the right)

image

4. Right-click on the branch that contains the current developments (in the above screenshot, it would be Main) and choose Get latest Version

image

This will download the latest checked in version of all the source code, metadata, and development projects that are under version control.

Visual Studio will display a confirmation box after the download of the updates is completed.

5. Determine which application packages need recompiling
This step is needed as a preparation for the next one, to build only the packages that have changed and save some time.

The main idea is that each subfolder of the Metadata folder corresponds to a package and underneath each package folder there are folders for models.

Option 5A – view the changes since a specific point in time
This is useful if you only have a few updates to apply and you know when your system was last updated.

Right-click on the main branch again and choose View History. This will open the History window.

image

Find the changesets that were created after the desired point in time. Double-click on each changeset to see what’s in it.

image

From the screenshot, we see that the changeset has updated 2 packages: ApplicationSuite and ElectronicReporting. These are the packages that we need to rebuild.

Option 5B – view all models that are under version control
Have a look at the Metadata folder in Source Control Explorer. From the example above, we see that there are 2 packages under version control: ApplicationSuite and ElectronicReporting. These are the packages that we need to rebuild.

Option 5C – rebuild everything
You can always skip the above options and rebuild everything. It will just take more time.

6. Rebuild
From the Visual Studio main meu, choose Dynamics AX > Build models… and select the packages to rebuild.

image

In the Options tab, I also checked Synchronize Database as the updates may include data structure changes.

image

Now click Build, wait until it completes (be patient!) and verify that there are no errors in the Output or Error List windows.

7. All done

Test that the desired changes are now available in your AX UI.

Connecting AX7 development environment to VSTS

With AX7, every developer must work on their own machine and share the work with others using Visual Studio Team Services (VSTS). I have covered setting up a new VSTS team project with a separate blog post. After the team project is created, each developer needs to connect their Visual Studio development environment to the team project.

Official reference info from AX7 Wiki: https://ax.help.dynamics.com/en/wiki/using-development-tools-in-ax7/

1. On the development machine, navigate to the VSTS web page of the customer

image

2. Click “Open in Visual Studio”
Skip all the warnings about the link security (Allow), non-Administrator mode, the folder structure, etc.

image_thumb18

image_thumb26

image_thumb28

3. The Configure Workspace pane will open with default values.
Click “Advanced…” to modify

image_thumb32

4. Add two working folders to map to the correct metadata and project folders
Note: the path to the AX metadata folder may be on a different drive, depending on whether your virtual machine is hosted locally or in Azure.

image

5. Clicking OK to confirm the folder mappings
Confirm getting the latest files to update the workspace by clicking Yes on this:

clip_image004

6. All done.

You can restart Visual Studio as an administrator and start development. The code changes will appear as pending under Team Explorer, and you can take advantage of all the features of version control in Visual Studio.