Search code examples
visual-studioreporting-servicesaxaptassrs-2012dynamics-ax-2012

How to connect Visual Studio to a specific dynamics ax environment


I would like to connect my Visual Studio against different dynamics ax environments. In particular the following two:

  1. Development Environment
  2. Production Environment

The purpose is to develope SSRS reports. In the production environments there are some reports which are not available in development and it would be complicated to create them. Not meaning that I'm going to develop against production (who would do such a thing?! ;-) ).

I found a tutorial which shows how to connect to a specific AOS by pointing visual studios start up parameter to an AXC file:

Tutorial for VS connection to specific AOS

When I follow the steps from the tutorial and open AX it seems that VS has connected to the correct AOS instance. See the following screenshot, showing two AOS instances one connected to Development the other to Production:

enter image description here

Also when I open the report from Production and from Development I can see that they are different in design, because there have been made some changed in Development.

Problem is: When I try to open a report with sample data, it always fetches the data from my Development environment. I also noticed that the SSRS report parameter @AX_UserCompany is always the company from my AX user settings in Development.

I know that VS is using my active directory user to authenticate against the AOS, but why is it always using the Development settings, even when VS is started with the Production AXC file as startup?

My question is: How is it possible, that VS pulls the SSRS report design from Production but the data from Development and what has to be done to retrieve both (Design and Data) from Production?

Any input is appreciated.


Solution

  • I could finally solve the mystery. It seems that Visual Studio is always using the connection properties stored in registry. Although the report design is loaded from AX instance specified in the AXC file, the data is pulled from the AX instance specified in the registry.

    The solution is to

    1. open the Dynamics AX Configuration Utility
    2. import the AXC file
    3. apply the AXC File
    4. refresh the configuration
    5. apply again

    Before you start, close AX and VS (just to be on the save side).

    1. open the Dynamics AX Configuration Utility

    Open AX Configuration Utility

    Located in "C:\Program Files\Microsoft Dynamics AX\60\BusinessConnector\Bin\AxCliCfg.exe".

    2. import the AXC file

    Import the AXC file

    Browse to your AXC file and import it.

    3. apply the AXC File

    4. refresh the configuration

    5. apply again

    Apply and refresh the configuration

    • Switch to the connection tab.
    • Then click apply.
    • Then click refresh the configuration. The WCF configuration will be regenerated.
    • Then click apply again.

    Of course this means that you can not have two VS instances open at the same time (e.g. one connected to production and one to development). You are limited to one configuration, because of the connection properties set in the registry.

    You still need two VS shortcuts:

    1. One VS shortcut with the AXC file to development
    2. One VS shortcut with the AXC file to production

    If you want to switch between environment you need to follow step 1. to 5.