问题
I would like to connect my Visual Studio against different dynamics ax environments. In particular the following two:
- Development Environment
- 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:
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.
回答1:
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
- open the Dynamics AX Configuration Utility
- import the AXC file
- apply the AXC File
- refresh the configuration
- apply again
Before you start, close AX and VS (just to be on the save side).
1. open the Dynamics AX Configuration Utility
Located in "C:\Program Files\Microsoft Dynamics AX\60\BusinessConnector\Bin\AxCliCfg.exe".
2. import the AXC file
Browse to your AXC file and import it.
3. apply the AXC File
4. refresh the configuration 5. apply again- 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:
- One VS shortcut with the AXC file to development
- One VS shortcut with the AXC file to production
If you want to switch between environment you need to follow step 1. to 5.
回答2:
Can you close the application explorer before closing VS? Then reopen VS with your shortcut and the application explorer.
I had the issue modifying the client and BC confits not changing the target for VS.
来源:https://stackoverflow.com/questions/35991751/how-to-connect-visual-studio-to-a-specific-dynamics-ax-environment