MicrosoftTFSVersionControlInAX5 WP
MicrosoftTFSVersionControlInAX5 WP
Security....................................................................................................... 7
Team Server Security ............................................................................................................ 7
Team Foundation Server Security ........................................................................................... 7
Branching.................................................................................................. 14
Primary TFS Project..............................................................................................................15
Project Interaction ...............................................................................................................17
Labeling .................................................................................................... 17
Labeling as Part of a Proxy Build ............................................................................................17
Setting Description
Status line The text entered for the status line will appear as a caption at the bottom
of the Microsoft Dynamics AX client.
Team Server name Specify the name of the Team Server (ID server) you set up.
Team Server Database name Specify the name of the ID server database you set up.
Compiler warnings If set to Reject, the code to check in cannot contain compiler warnings.
Compiler errors If set to Reject, the code to check in cannot contain compiler errors.
Compiler to-dos If set to Reject, the code to check in cannot contain to-do comments.
Best practice errors If set to Reject, the code to check in cannot contain best practice errors.
This setting does not affect objects that have best practice warnings or
information. For more information, see Best Practices for Microsoft
Dynamics AX Development in the product documentation.
Run title case update If selected, the name of each object is checked for correct casing.
Application object names, such as methods or table fields, should begin
with a lowercase letter. Incorrect casing is fixed. For more information,
see Naming Conventions in the product documentation.
Object rules Object types or names can be prohibited in the Object rules tab. For
more information, see the product documentation.
Additional subfolders You can select where new objects are created by using the Additional
subfolders tab. More than one folder can be specified, and the
developer will be prompted to choose one of the locations when a new
object is created. A description should also be provided for each folder
value.
Test project Specify the test project to run when you check in code.
Setting Description
Source control status Set to Enable to work under version control.
Version control system Set to Team Foundation Server to use TFS for version control.
Color checked-out objects in the AOT If selected, objects will be blue in the AOT of the developer who checks
out the object.
Warn when reverting objects If selected, the developer will be warned before objects are reverted.
Team Foundation Server URL Specify the TFS URL. The default port is 8080. For example,
http://fts:8080.
Team Foundation project name Specify the project you created in TFS.
Undo Check-out
You can choose not to check your changes in to version control. If you undo check-out, your changes
will be discarded and the object will revert to the version of the object that is in the repository.
Check In
To persist the changes you make to a checked-out object, you must check the object back in.
When you check an object in, the Check in form displays. All the objects you check in will be accepted
or rejected. By default, the Check in form will display all objects you have open. You can remove
objects from the list by pressing ALT+F9. When you check in objects, provide a detailed description of
the work you did in case you later decide to revert to a particular version of an object.
Quality Checks
The code you check in must comply with the quality checks that are set up by the administrator on the
System settings form. The available checks are:
Compiler errors
Compiler warnings
Complier to-dos
Best practice errors
Renaming Objects
After an object has been added to version control, it can still be renamed. When an object is renamed,
a copy of the object is created with the new name and the object with the old name is deleted. To
complete a deletion, the object must be checked in. To check in an object for deletion, use the
Pending objects form.
Even though a new object is created when you rename an object, the history of the deleted object is
maintained. When you rename an object, you must update all references to the object. To update
interdependencies between objects, do as follows:
1. In the AOT, right-click the object you have renamed and then click Add-Ins > Cross-reference
> Used by.
2. Check out all the objects that are listed.
3. Update the references and then check in the objects.
Deleting Objects
You can delete objects that are under version control as you would ordinarily delete an object. The
deletion will take effect when the object is checked in. Use the Pending objects form to check in the
object. You can undo a deletion before you check the object in.
Get Latest
To synchronize a single application object to get the changes that other developers have made to an
object, use the Get latest command. You cannot use this command when you have the object
checked out.
Synchronization
After you create a local repository folder on your developer machine, you must synchronize your local
repository folder with the objects in the version control system to populate your local repository.
Later, you can synchronize your local repository with the version control system to reflect changes
made by other developers.
To synchronize all objects, click Microsoft Dynamics AX > Tools > Development tools > Version
control > Synchronize. Synchronization does not affect new objects that you created or objects that
you have checked out.
Consider the folder you choose for the local repository folder. If a Team Explorer instance that runs
against the source control server shares a local repository folder with a Microsoft Dynamics AX 2009
client and a change is checked in by using Team Explorer, the Microsoft Dynamics AX 2009 client will
not reflect those changes when you synchronize the Microsoft Dynamics AX client unless you select
Force when you synchronize. Installing Team Explorer on developer computers is optional.
If you select Force, all application objects will be synchronized, even if they have not changed. A
forced synchronization can take a long time. Consider installing a new build as an alternative.
If your version control system is set up to include folders in addition to those used for the AOT and the
label files, you can choose which of these folders to synchronize. This is done on the Pick folders
form that opens after you click OK on the Synchronization form.
Synchronization Log
TFS tracks object versions on the client. When you synchronize, the latest version is copied from TFS
to your local repository. Each file must be imported into Microsoft Dynamics AX to be reflected in the
AOT. A log entry is created for each file to validate that each file is imported. If the synchronization
fails, use the Synchronization Log form to select the paths of failed elements and then click
Process.
10
Command Description
Change list Displays a list of other objects that were included in the check-in with the
object.
Compare Displays the Comparison form that allows you to perform a line-by-line
comparison of two versions of an object. The Comparison form lists all
checked-in versions of an object and all normal layer object versions.
Open new window Opens the AOT with the selected version of the object to investigate
object properties.
View file Opens an .xpo file of the specified object version in Notepad.
Pending Objects
You can view a list of objects that are checked out by using the Pending objects form. You can select
objects to check in or you can discard the check-out. Depending on the version control settings, other
developers may be able to work concurrently on the same objects you have pending. From the
Pending objects form you can also create a project or import objects.
Change List
You can track all check-ins performed in TFS by using the Changes form. You can view the change
number, the date and time of the change, the user who submitted the change, and check-in
comments. You can see the objects that are included in a change by clicking the Contents button.
The initial change includes all AOT objects. If you click the Contents button for the first change, it will
take a long time to open the Contents form.
Working Offline
You can still develop in Microsoft Dynamics AX when you are not connected to the version control
server. Check out the objects you want to modify before you go offline, and then check them in again
when you are reconnected.
You cannot create object IDs when you are offline. You must be connected to Team Server (the ID
server) because it controls the allocation of object IDs. If you need to create an object that requires
an object ID, follow these steps:
1. Create the new object offline.
2. Export the object.
3. Connect to version control.
4. Delete the new object.
5. Import the new object (this will assign an object ID).
6. Add the object to version control and check it in.
11
Layer Promotion
Layer promotion (or migration) is a method of deploying changes to another environment. In layer
promotion, the entire layer Application Object Data (AOD) file in the destination environment is
replaced using the source environment. You can only use this method if all modificat ions in the
destination environment are included in the source environment, and there is no in-progress
development activity in the source environment.
The following steps demonstrate how you can deploy changes to another environment using layer
promotion.
1. Check users.
Make sure that no users are using the destination environment.
2. Stop AOS.
Stop the Application Object Server (AOS) service on the source and destination environments.
3. Rename the AOD or label file.
Rename the appropriate AOD or label file in the destination environment. For example, change the
axcus.aod file to axcus.aod.old.
4. Copy AOD or label file.
Copy the appropriate AOD or label file from the source environment to the destination
environment.
5. Delete AOI file.
Delete the Application Object Index (AOI) file from the destination environment.
6. Restart AOS.
Restart the Dynamics AX Object Server service on both environments. Restarting the service on
the destination environment may take several minutes because the AOI file must be rebuilt.
7. Synchronize the database.
Synchronize the SQL objects by using the Synchronize Database process (Administration >
Periodic > SQL Administration > Table Actions > Synchronize Database).
8. Validate.
Check the updated environment to make sure all objects function correctly.
9. Recompile.
Optionally recompile the application if you discovered issues when you validated (Administration
> Periodic > Compile application).
12
13
Branching
Branching enables concurrent development within the Microsoft Dynamics AX 2009 environment and
provides a means of remediation and bug fixes in previously released versions without interrupting
ongoing development activities. This concurrent development is accomplished by providing each
endeavor by a developer with a separate source code repository that contains the specific items and
version that is needed to complete the effort. For an example of how you can incorporate branching,
see the Microsoft Dynamics AX 2009 Branch Support Plan using Team Foundation Server that is
included at the end of this white paper.
Branching occurs when a snapshot of code is taken at a specific point of the main, or baseline, project.
This baseline is usually represented by a label. The snapshot is known as the child branch, and the
source of the snapshot is called the parent branch. Merging is the process of copying the source code
to a separate TFS project, or synchronizing changes between two separate projects or branches.
Merging takes place only within TFS.
Basic development practices can be applied in this environment. No development activities occur
directly on the main (baseline) branch. Changes that are made in development branches are merged
into the main branch. There is no direct interaction between any other branches.
The main TFS project is branched to create the development project. Changes made in the
development project are merged into the main branch for testing. The merge from the development
branch to the main branch can be automated by using a script. If the merge is automated, consider
your development practices and best practice settings. If the best practice settings are set too low,
you may not want to automate merging because it is important to keep the main branch functional.
The release branch is a contingency branch that is used for hot fix development for released versions.
This branch is created for either remediation or to address issues that arise in released versions. After
the development activities are completed on this branch, the changes are merged into the main
branch, and then to the development branch. The labeling of releases is a prerequisite for branching
at a point in time.
Each branch must be deployed to a stand-alone TFS project to continue development activities within
that branch. Changes to the child branch are synchronized using a TFS process called merging.
14
This example illustrates the practice of creating separate project branches. In this case, devTeam1
represents developers working in geographically or functionally separate areas. Each separate
development branch requires a separate intermediate TFS project and a separate development
environment for development activities. This concept can also be used for the release project to allow
for remediation and issue management in multiple versions of released code.
15
16
Labeling
In TFS, labels are used to mark milestones in the development lifecycle, particularly product releases.
Labels are important to release branching, where the main project is branched at a point in time for
remediation or issue management. Labels can be applied to source code through one of the following
methods:
Using the command line utility
From the TFS context menu
Automatically during the build process in TFS
The TFS build process requires the installation of the Team Foundation build utility, which is typically
installed on a separate machine. You can use the build utility to create a proxy build that will label all
the source code in the project based on parameters that are entered during the build process. These
labels are stored in TFS and can be used for subsequent branching. For more information on labeling,
see the Team Foundation Server Administration Guide.
17
18
19
Best Practices
Some recommended best practices are as follows:
TFS merge relationships and paths should be defined in advance. Always begin merge
activities at an endpoint in the path.
If a primary project is used, merge activities should always begin in an intermediate project
and flow through the primary project to all remaining projects and branches.
A viable MorphX project structure should be established for each implementation. This is
important to restore incomplete work if a TFS reset is required. Some options include:
o One project that contains all of the objects and modifications for a project or phase.
o One project for each planned modification. The project structure mimics the AOT
structure.
o One master project where each modification is a subproject. The subproject structure
mimics the AOT structure.
Rules should be established for the check-in of in-process modification activities.
The TFS SQL databases should be included in a SQL Server maintenance plan and in the
network backup plan.
o Include Report Server and WSS databases in the backup plan.
o Full and transaction log backups are required because many of the TFS databases use
a full recovery model.
A data recovery process for TFS data should be established.
The Microsoft Dynamics AX 2009 Team Server database should be included in a database
maintenance plan.
Security should be proactively managed. If Team Explorer is installed on each developer
installation, developers should only have access to the TFS project they use. Only
administrators should have access to all TFS projects.
20
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the
date of publication. Because Microsoft must respond to changing market conditions, this document should not be interpreted to be a
commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of
publication.
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS
TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of
this document may be reproduced, stored in or introduc ed into a retrieval system, or transmitted in any form or by any means
(electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission o f
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject
matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this
document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
22