In previous blog posts we have talked about the way that other applications can drill down into parts of GP by using an direct approach via a pluggable protocol handler that is installed when GP is installed. Sometimes this does not work, to debug if the protocol handler has an end point to talk to follow these instructions.
Download Handle.exe which is part of the SysInternals tools that Microsoft acquired some time back, written by Mark Russinovich,
Extract the Zip file, if you have 64 bit system use the 64 bit version, otherwise use the plain version.
Use PowerShell to pipe out and decode handle.exe output
Open a PowerShell editor on your machine (e.g. start menu, search powershell, launch Windows PowerShell ISE)
In my case I extracted the handles.exe into the C:\Users\tw\Documents\ folder, you will need to change the path for where you extracted it to…
Execute the following PowerShell Command:
C:\Users\tw\Documents\handle64.exe net.pipe -accepteula
This will accept the user agreement and pipe the output of the handle viewer to powershell for decoding.
This gives the following output.
You can see that visual studio and Dynamics.exe have named pipes running.
If I close Dynamics GP, then run it again…
You see that Dynamics .exe is not listed as having named pipes available anymore as it is closed.
Using powershell to list all
The PowerShell modules for GP allow a number of DevOps activities. For example you may install the Dynamics GP Lesson (sample) company TWO and install the system database via these PowerShell modules. I take full advantage of the PowerShell modules when running and building Docker images for Dynamics GP.
Today whilst doing this I encountered the following error when moving to build the image for a different version of Dynamics GP:
Macro failed to complete successfully.
The PowerShell script works by creating a macro file in the GP\data folder, the PowerShell script then runs DexUtils passing the macro file as a command parameter. The macro file tells utilities what it needs to do (in this case create the system database), you can see this macro in the folder below, captured after this error occurred in the Docker container. CreateSysetmDatabase.mac is the macro file that PowerShell is using to create the system database.
We have no idea at this point what the error actually is, as the error description of “Macro failed to complete successfully” is not very helpful. However you will notice also in that folder the “DexMacro.log” file. Lets look in that file by reading it with the command “type DexMacro.log”.
So below is the output of that command, the contents of the log.
There we can see the issue, I’m using SQL Server 2017, I already know this is only compatible with GP2018 onwards. However you will notice from the folder name I’m trying to use it with GP2016. The error is badly worded, it says you need to upgrade to server 11 from 14. It actually means you need to use an older version of SQL for this version of Dynamics GP. Something I already knew but my focus wasn’t in this area at the time I was developing the Docker container.
Please comment if you found this helpful – motivates me to blog more!
If you are using Dynamics GP with Visual Studio 2017 –> , you will find that the project templates for Dynamics GP do not show up in the new project or new item menus.
I wrote a solution to this in the form of a Visual Studio extension, but it seems that the extension is not showing up when it is searched for in the extension gallery, something brought to my attention via the Microsoft forums.
However if you page through the results then go back to page one of the results, then all of a sudden it appears in the list!
I’ll be bringing this to the attention of the VS team, in the meantime the video shows this work around.
I’ve never written this up before, but is a useful technique I use to allow the deployment of GP from the current project active build directory to the application addins folder.
Note that in this example PowerShell script, it will empty the addins folder before deploy. This may not be appropriate where other addins are present, tweak the deploy.ps1 script as appropriate for your development environment.
Setup external tool
Create a Deploy directory in the root of the project you wish to enable for copy deployment to the GP addins folder.
Save the following Deploy.ps1 script to that folder
Write-Host "Deploy from: $deployFrom To: $deployTo"
Remove-Item -Recurse -Force "$deployTo\*"
Get-ChildItem -Path $deployFrom -Recurse | Copy-Item -Destination $deployTo
Write-Host "Deploy complete"
Set up the external tool for launching the powershell script:
-File "$(ProjectDir)\Deploy\Deploy.ps1" "$(TargetDir)" "C:\Program Files (x86)\Microsoft Dynamics\GP2018\AddIns"
Deploy GP Add in
Use Output window checkbox checked
This will add a menu under the Visual Studio Tools menu of “Deploy GP Add in”, that will run the powershell script added to the project. The script takes the current project folder and uses it as a source to deploy GP from the current build target directory. Thus the deployment will honour the configuration type currently selected and the project currently selected will be selected as source.
To assign a keyboard shortcut
From Visual Studio Menu select Tools>Customize
Click “Keyboard” button
Use the show commands containing: search box to search for tools.external:
Then assign a shortcut by clicking the shortcut key combations while focus is on the “Press shortcut keys:” field