Tuesday, April 12, 2011

AX 2009 and Visual Studio 2010

Out of the box EP Visual studio Add-in (Enterprise portal tools) shipped with AX2009 doesn't work with VS2010. With few simple steps it is possible to make it compatible. AX installer performs validation for VS2008 so all installations steps for Enterprise portal tools have to be done manually:

  1. Copy DVD\MSI\EnterprisePortalTools to C:\Program Files\Microsoft Dynamics AX\50\EnterprisePortalTools
  2. Rename file Microsoft.Dynamics.Framework.Portal.VisualStudio.2008.AddIn.AddIn to Microsoft.Dynamics.Framework.Portal.VisualStudio.2010.AddIn.AddIn
  3. Edit the file: replace VS version 9.0 with 10.0
  4. Open VS2010: Tools->Options->Add-in/Macros security and add C:\Program Files\Microsoft Dynamics AX\50\EnterprisePortalTools
  5. Open DVD\MSI\Components64\
  6. Unpack AxWebProject.zip
  7. File ProjectName.webproj is just one bit big. For VS2010 it should be 0: either delete the file and create new one with same name or edit it and delete it's content
  8. Pack it back to AxWebProject.zip
  9. Create folder My Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual Web Developer\CSharp
  10. Copy AxWebProject.zip to My Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual Web Developer\CSharp
  11. Create folder My Documents\Visual Studio 2010\Templates\ItemTemplates\Visual Web Developer\CSharp
  12. Copy AxWebpartPage.zip and AxWebUserControl.zip from to My Documents\Visual Studio 2010\Templates\ItemTemplates\Visual Web Developer\CSharp
  13. Open VS2010 and make sure that EP project template is available
  14. To add EP specific Items to Visual Studio's Toolbox, select "Chose items" from the right click menu on VS's toolbox
  15. Browse for C:\Program Files\Microsoft Dynamics AX\50\Client\Bin\Microsoft.Dynamics.Framework.Portal.dll

Wednesday, April 28, 2010

Performance improvement by changing position of dataAreaId field in index

Performance-wise, fields in the index should be sorted by selectiveness. Most selective(unique) fields needs to go first and least selective should be in the end of the list. 
By default AX kernel creates indexes with dataAreaId field at first position in the index which is good if you work with multiple companies. Position of DataAreaId field 
can be changed by adding the dataAreaId as a field in an index:
1. right click on the index and click "New Field"
2. select dataAreaId in the index field properties
When it is done dataAreaId can be placed at any position in the index(last one in my case). AX kernel will keep that position and won't override it.
  

Friday, October 2, 2009

Breakpoint in Add method of Info class

Sometimes for debugging purposes breakpoint needs to be set in Add method of Info class. It is quite easy thing to set a breakpoint but it is possible to make it even more simple with following Editor script:
There might be some better place for this code but this is my way.



Monday, September 22, 2008

Building AX solution with TFS

Since MS introduced TFS version control in DAX 2009 I got an idea to leverage TFS build functionality. It is great advantage to have build work done in three mouse clicks or even scheduled to be done while I'm sleeping. This also gives confidence that all project related files are in right place and at right time.

In frame of AX, Build is source code file combined from separate compiled without errors pieces of code that belongs to same solution together with label file.

I assume that you are familiar with TFS if not I recommend starting from reading MSDN.

The setup process consists of several steps:

  1. TFS: First of all TFS server must be installed.
  2. Build agent: TFS build agent must be installed and run on behalf of user registered in AX. Usually it is non-interactive domain user. Here you can find more information about creation and management of Build Agents.
  3. Version control: I assume that all project related AX objects are checked in into TFS source control. This document describes how to set up the version control system for Microsoft Dynamics AX 2009 using Microsoft Visual Studio Team Foundation Server.
  4. ID Server: this document describes how to install Team Server, which is the ID server that is required if you use Team Foundation Server or Microsoft Visual SourceSafe for version control.
  5. Fake solution: TFS needs solution to build. Since we just need to get sources, combine them and put in right place one can create "fake" solution - empty solution to make TFS happy with building something "real". This "fake" solution has to be created and added to source control.
  6. Build definition: this document describes how to create a build definition. Later you can edit it. Actually if everything was setup correctly in build definition wizard only two corrections are needed for sources to get *.xpo files only and "After
    Get" task:


  7. Put CombineXPOs.exe found here to yourBuildDirectoryPath folder.
  8. Next step might be build scheduling.
  9. Next you can create bat file to import your just generated build into AX:

    That is why build agent has to run with AX user credentials.

When everything is checked in and CombineXPOs.exe is in right place you are ready to generate your first AX build. To queue new build just right click on build definition in the Team explorer, select "Queue new build" and click "Ok". This document describes how to Queue new build if you need more information. And voila... build is generated.

You can easily access to your builds by right click and "Open drop location". 

I believe this simple routine will save a lot of time for you!