The following examples take on the example of deploying the fictional .NET application app.exe
.
NOTE: With ClickOnce you can only deploy .NET applications out of the box. Ho, cf. How can I deploy a non .net application with ClickOnce?.
Create the application manifest from the build output (binaries)
mage -n Application -t app\app.exe.manifest -fd app
Then create the deployment manifest
mage -n Deployment -t app.application -appm app\app.exe.manifest
IMPORTANT: The .NET app should be created without manifest, cf Walkthrough: Manually Deploying a ClickOnce Application (MSDN)
mage -u app.application -pub <Publisher> -n <AppName>
If either value contains whitespace wrap in quotes like this
mage -u app.application -pub "My cool Publisher" -n "My cool app"
mage -u app.application -i false
mage -u app.application -i true
This means installing a start menu entry and optionally a desktop shortcut.
*NOTE: For -i true
you need to also set publisher and product name.
To make for a desktop shortcut include the attribute createDesktopShortcut="true"
in the deployment
element of the deployment manifest
<deployment ... co.v1:createDesktopShortcut="true">
NOTE: This assumes the xml-namespace xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1"
is declared in the xml-root element assembly
.
To disable desktop shortcut, set to false
or simply remove the attribute as this is the default.
mage -u app\app.exe.manifest -if custom.ico
The specified icon should be visible as the Desktop shortcut and in the Taskbar. When running the app directly after installation or download (default), the taskbar icon may still be a generic icon. This is a known ClickOnce bug. Just restart the app to see the updated icon.
NOTE: For the custom.ico
to be used it needs to be deployed with the application. For a new icon file, place it in the app directory and update the application manifest. Easiest is to populate from directory like this
mage -u app\app.exe.manifest -if custom.ico -fd app
NOTE: For some odd reason ClickOnce cannot use alpha channel in 32bit icon files. Instead it uses the lower left pixel value as a heuristic for the transparent pixel. So be sure to add a 1 pixel extra boundary. For more details see How to fix your ClickOnce icons.
Customizing the icon in Control Panel\Programs\Programs and Features
is not directly supported in ClickOnce.
ClickOnce will always show a generic ClickOnce icon. To customize the icon you need to change the registry.
Here is an example on how to do this in code on first start ClickOnce: Setting a custom icon in 'Add/Remove Programs'