---
name: dotnet-clickonce-config
description: Configure ClickOnce deployment with auto-update, prerequisites, and publish settings for .NET applications
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
tags: [dotnet, clickonce, deployment, auto-update, windows]
---
# dotnet-clickonce-config
Configure ClickOnce deployment for .NET applications with auto-update capabilities, prerequisite management, and publish settings. This skill sets up the complete ClickOnce deployment pipeline.
## Capabilities
- Configure ClickOnce publish settings
- Set up automatic update checking
- Manage application prerequisites
- Configure file associations
- Set up signing with certificates
- Generate publish profiles
- Configure deployment manifest
- Set up web or file share deployment
## Input Schema
```json
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Path to the .NET project"
},
"publishSettings": {
"type": "object",
"properties": {
"publishUrl": { "type": "string" },
"installUrl": { "type": "string" },
"updateMode": { "enum": ["foreground", "background"] },
"updateInterval": { "type": "number" },
"minimumVersion": { "type": "string" }
}
},
"prerequisites": {
"type": "array",
"items": { "type": "string" }
},
"fileAssociations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"extension": { "type": "string" },
"description": { "type": "string" }
}
}
},
"signing": {
"type": "object",
"properties": {
"certificatePath": { "type": "string" },
"timestampUrl": { "type": "string" }
}
}
},
"required": ["projectPath", "publishSettings"]
}
```
## Output Schema
```json
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"type": { "enum": ["pubxml", "manifest", "settings"] }
}
}
},
"publishCommand": { "type": "string" }
},
"required": ["success"]
}
```
## .csproj Configuration
```xml
WinExe
net8.0-windows
true
https://myserver.com/myapp/
https://myserver.com/myapp/
https://myserver.com/myapp/
1
1.0.0.*
true
My Company
My Application
true
true
Web
true
Foreground
7
Days
true
false
False
.NET Framework 4.8
true
```
## Publish Profile (pubxml)
```xml
ClickOnce
bin\publish\
https://myserver.com/myapp/
https://myserver.com/myapp/
https://myserver.com/myapp/
1.0.0.*
Release
Any CPU
net8.0-windows
false
win-x64
false
false
true
Web
true
true
publish.htm
true
Foreground
7
Days
true
false
true
1234567890ABCDEF
http://timestamp.digicert.com
en-US
My Application
My Company
false
```
## Programmatic Update Checking
```csharp
using System.Deployment.Application;
public class UpdateManager
{
public async Task CheckForUpdatesAsync()
{
if (!ApplicationDeployment.IsNetworkDeployed)
{
return false;
}
var deployment = ApplicationDeployment.CurrentDeployment;
try
{
var info = deployment.CheckForDetailedUpdate();
if (info.UpdateAvailable)
{
if (info.IsUpdateRequired)
{
// Force update
deployment.Update();
Application.Restart();
return true;
}
else
{
// Optional update - prompt user
var result = MessageBox.Show(
$"Version {info.AvailableVersion} is available. Update now?",
"Update Available",
MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
deployment.Update();
Application.Restart();
return true;
}
}
}
}
catch (DeploymentDownloadException ex)
{
MessageBox.Show($"Update failed: {ex.Message}");
}
return false;
}
public Version GetCurrentVersion()
{
if (ApplicationDeployment.IsNetworkDeployed)
{
return ApplicationDeployment.CurrentDeployment.CurrentVersion;
}
return Assembly.GetExecutingAssembly().GetName().Version;
}
}
```
## Publishing Commands
```bash
# Publish via dotnet CLI
dotnet publish -p:PublishProfile=ClickOnce
# Publish via MSBuild
msbuild /t:Publish /p:PublishProfile=ClickOnce
# Publish with version increment
dotnet publish -p:PublishProfile=ClickOnce -p:ApplicationRevision=$(($(date +%s)))
```
## Signing Configuration
```xml
true
YOUR_CERT_THUMBPRINT
http://timestamp.digicert.com
```
```powershell
# Find certificate thumbprint
Get-ChildItem -Path Cert:\CurrentUser\My | Format-Table Thumbprint, Subject
# Sign manually
mage -sign MyApp.application -CertFile cert.pfx -Password mypassword
```
## Server Setup (IIS)
```xml
```
## Best Practices
1. **Always sign manifests**: Required for production
2. **Use semantic versioning**: Clear version updates
3. **Set minimum version**: Force updates for critical fixes
4. **Test update flow**: Verify before releasing
5. **Use HTTPS**: Secure download channel
6. **Monitor publish folder**: Verify deployment success
## Related Skills
- `windows-authenticode-signer` - Code signing
- `auto-update-system` process - Update workflow
- `desktop-build-pipeline` process - CI/CD
## Related Agents
- `wpf-dotnet-expert` - .NET expertise
- `release-manager` - Release coordination