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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s