ClickOnce – Automatically update version

I often have to update Dynamics NAV ClickOnce applications and I got tired of updating the version in the two manifest files, that is why I updated my batch file to do it for me.

I keep my ClickOnce application files in c:\inetpub\wwwroot\xxx. When I need to make changes I edit or add files to that folder. When any change are made to the ClickOnce application files you need to update the manifest files using mage.exe. To do that I use this batch file (run as administrator)

SET /p VERSION=<c:\clickonce\NAV2016Demo.version.txt
>c:\clickonce\NAV2016Demo.version.txt ECHO %VERSION%
CD C:\inetpub\wwwroot\ClickOnce\NAV2016demo\Deployment\ApplicationFiles
DEL /Q web.config
c:\clickonce\mage.exe -update Microsoft.Dynamics.Nav.Client.exe.manifest -FromDirectory . -version %VERSION%
CD C:\inetpub\wwwroot\ClickOnce\NAV2016demo\Deployment
c:\clickonce\mage.exe -update Microsoft.Dynamics.Nav.Client.application -appmanifest ApplicationFiles\Microsoft.Dynamics.Nav.Client.exe.manifest -appcodebase -version %VERSION% -minVersion %VERSION%
COPY c:\clickonce\web.config C:\inetpub\wwwroot\ClickOnce\NAV2016demo\Deployment\ApplicationFiles\

This will update the manifest files and increment the version and minimum required version by 1.

Please note that the current version is read from the file C:\ClickOnce\NAV2016Demo.version.txt file and not directly from the manifest files (too complicated for me ;-))

Also note that the version will be set to 9.0.0.x where x is the number that is incremented. You can of course modify this any way you like.


Adding BGInfo extension on Azure Resource Manager VM

Microsoft has not yet added a way to add extensions to Resource Manger VMs on Azure. Luckily there is a way to do this using Powershell.


You need to have the Azure Powershell tools installed – see

Afterwards connect to Azure – see this

First step:

First we need to install the Windows Azure VM Agent on the VM server. This can be downloaded from here Р

You need to run this installer from an elevated command prompt (run command prompt or Powershell as administrator).

If you skip this step you will be in all kinds of trouble ūüėČ I didn’t install this before I installed the BGInfo extensions. The extension was installed, but the status was failed. Also the standard extension (if you installed diagnostics) Microsoft.Insights.VMDiagnosticsSettings failed after this. Installing the Azure VM Agent afterwards does not solve these problems. I’m currently trying to uninstall the BGInfo extension again from the portal, it has been running for 54 minutes now… I will update this post later, when I have a solution for this mess.

Second step:

Start up your Azure Powershell and connect to your subscription (see prerequisites)

Run this command to install the BGInfo extension (thank you BigSkyTech – Technet forums post)

Warning! Users will get disconnected while the VM is being updated!

Set-AzureRmVMExtension -ExtensionName BGInfo -Publisher Microsoft.Compute -Version 2.1 -ExtensionType BGInfo -Location northeurope -ResourceGroupName YOUR_RESOURCE_GROUP -VMName YOUR_VM_NAME

Next time you log in to your server, the BGInfo should now be displayed, yay!

The extension also becomes visible in the Azure management portal Рlook under Virtual Machines > YOUR_VM > Settings > Extensions

Want more?

Wanna see all¬†available extensions? Run this…

Get-AzureVMAvailableExtension | Out-GridView

If you want to install Microsoft Antimalware you can run…
Don’t use this just yet… it’s kinda buggy ūüė¶
Set-AzureRmVMExtension -ExtensionName IaaSAntimalware -Publisher Microsoft.Azure.Security -Version 1.3 -ExtensionType IaaSAntimalware -Location northeurope -ResourceGroupName YOUR_RESOURCE_GROUP -VMName YOUR_VM_NAME
Be patient, it can take quite a while to add certain extensions, don’t give up! ūüôā



sessionState mode=”InProc”

Just wanted to share a silly mistake that I made when testing NAV 2016 web client (could have been any version).

NAV 2016 webservice error


When trying to access the webclient I got the above error (<sessionState mode=”InProc”/>).


I forgot to add the port number in the url. The webclient runs on port 8080 (default), but I didn’t specify this when typing in the url. I was trying to access instead of

The reason this has given me such a headache is that the url does exist, but the web client is configured for port 8080 which is why I am getting the above error.

I hope this will help someone else save some time ūüôā

“Microsoft.Dynamics.Nav.Client has stopped working” error when starting NAV client

“Microsoft.Dynamics.Nav.Client has stopped working”

This message has given me a headache today, but now I finally found a solution…

The error message came up when I tried to start up the NAV 2013 RTC client. There were 2 error messages in the Event Log, but none of them said anything useful.

I have been fighting with a problem similar to this once before, where I had to give up and never found a solution. The problem seemed to be related to roaming profiles where the user profile was stored¬†at \\server\profiles$\username\… and the error message there was something like “app data path contains illegal characters”. Anyway, my point is that this customer only had this problem on Lenovo laptops. There were no problems running NAV in a VM using the same username and Group Policies.

This makes me think that there might be some kind of software preinstalled on Lenovo computers?!? There seem to be a problem when the NAV client has to write to C:\Users\username\appdata\…

Long story short… I fixed the problem by changing the NAV 2013 RTC shortcut and adding the parameter -settings:”C:\ProgramData\Microsoft\Microsoft Dynamics NAV\70\ClientUserSettings.config”.


Hyper-V VM stuck in backing up status

Sometimes Hyper-V VMs gets stuck in a backing up status. You can’t see this status in SCVMM but it shows in the Hyper-V Manager. When a VM is in a backing up state, all backups will fail!

If you try to reboot the Hyper-V host server, it will often hang, trying to shut down the Hyper-V Virtual Machine Management service.

I have been struggling with this issue for quite a while, but now there is finally a much better solution than having to reset the Hyper-V host server.

EDIT: This can be fixed with a single Powershell “script”. Run Powershell as administrator and then run “get-process -name vmms | select id | kill -force” on the Hyper-V server. The process will start automatically again after a few seconds. Everything will keep on running, only the Hyper-V manager will loose connection for a few seconds.

Here’s the solution –

Thanks Richard!


If you want to use Powershell to show the status of all your VM’s across all Hyper-V servers, you can use this:

Get-VM -ComputerName hpv01,hpv02,hpv03