> For the complete documentation index, see [llms.txt](https://docs.patchmypc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/update-an-application.md). Agents can also search and read this documentation through its [MCP server](https://docs.patchmypc.com/~gitbook/mcp).

# Update an application

Publish a new version of one of your custom applications with the Patch My PC Cloud Customer API.

[Back to the Cloud Customer API overview](https://docs.patchmypc.com/patch-my-pc-cloud-api)

When a vendor releases a new version of an application you packaged yourself, you publish it as an update to the existing custom application. The application keeps its product ID, and the new version gets its own update ID.

An update replaces the application's files and packaging details—for example the installer, install arguments, and detection. The application's descriptive details, such as its display name and publisher, stay the same.

Like creating an application, an update uploads files. The .NET SDK and the PowerShell module do the upload for you, so we recommend them over REST.

This guide covers the SDK and PowerShell module. For REST, see [Create update draft](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api/applications.md#create-update-draft), [Complete application update](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api/applications.md#complete-application-update), and [Sync application deployment](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api/applications.md#sync-application-deployment). The separate [REST walkthrough](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/create-a-custom-application-with-rest) demonstrates creating and deploying an application, not publishing a new version.

## Before you begin

* Exchange a personal access token (PAT) for an access token. See [Authentication](https://docs.patchmypc.com/patch-my-pc-cloud-api/authentication.md).
* A PAT needs the `appcatbroker:apps:write` scope, and `appcatbroker:apps:read` to look up the application.
* Prepare a folder with the new version's installer and supporting files, as described in [Create a custom application](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/create-a-custom-application.md).

## Step 1: Find the application and its current version

1. Search for the application.
2. Note its `productId` and `custom.updateId`. When you create an update draft with REST, pass `custom.updateId` as the request's `updateId`.

{% tabs %}
{% tab title="C#" %}

```csharp
var search = await client.SearchApplicationsAsync(new ProductFilterRequest
{
    DisplayNameSearchString = "Contoso Sample Agent"
});

var current = search.Value.Products.First();
```

See [SearchApplicationsAsync](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#searchapplicationsasync).
{% endtab %}

{% tab title="PowerShell" %}

```powershell
$current = Find-PmpcCustomApplication -DisplayName 'Contoso Sample Agent' | Select-Object -First 1
$current | Select-Object DisplayName, Version, ProductId, @{ Name = 'UpdateId'; Expression = { $_.Custom.UpdateId } }
```

See [Find-PmpcCustomApplication](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/find-pmpccustomapplication.md).
{% endtab %}
{% endtabs %}

## Step 2: Publish the new version

{% tabs %}
{% tab title="C#" %}
{% code title="Program.cs" %}

```csharp
var updated = await client.UpdateApplicationAsync(new ApplicationUpdateMetadata
{
    ProductId = current.ProductId,
    UpdateId = current.Custom!.UpdateId,
    FolderPath = @"C:\Packages\ContosoAgent-4.3",
    PrimaryInstallerFile = "ContosoAgent.msi",
    MsiProductCode = Guid.Parse("{msi-product-code}"),
    CmdArguments = "/qn",
    ArpVersionMatch = "{version}"
});

if (updated.IsFailure)
{
    Console.WriteLine($"{updated.Error.Code}: {updated.Error.Message}");
    return;
}

Console.WriteLine($"New version {updated.Value.UpdateId} of product {updated.Value.ProductId}");
```

{% endcode %}

You can pass an `IProgress<UploadProgress>` to report upload progress, as when creating an application.

See [UpdateApplicationAsync](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/applications.md#updateapplicationasync).
{% endtab %}

{% tab title="PowerShell" %}
Use the product and update IDs returned by `Get-PmpcCustomApplication` or `Find-PmpcCustomApplication`. Provide the new version with `-ArpVersionMatch`. For an MSI installer, also provide the new installer's product code; the installer type cannot change between versions.

```powershell
Update-PmpcCustomApplication -ProductId '{product-id}' -UpdateId '{update-id}' -FolderPath 'C:\Packages\ContosoAgent-4.3' -PrimaryInstallerFile 'ContosoAgent.msi' -MsiProductCode '{msi-product-code}' -CmdArguments '/qn' -ArpVersionMatch '{version}'
```

See [Update-PmpcCustomApplication](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/update-pmpccustomapplication.md).
{% endtab %}
{% endtabs %}

## Step 3: Roll out the new version to an existing deployment

If the application is already deployed, sync the deployment to move it to the latest pending version instead of waiting for its scheduled sync. Deployments belong to a connection, so select the connection first—see [Deploy an application](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/deploy-an-application.md).

1. List the application's deployments and note the `deploymentId` of the one to update.
2. Sync that deployment.

{% tabs %}
{% tab title="C#" %}

```csharp
var sync = await client.SyncDeploymentAsync(current.ProductId, "{deployment-id}");
if (sync.IsFailure)
{
    Console.WriteLine($"{sync.Error.Code}: {sync.Error.Message}");
}
```

See [SyncDeploymentAsync](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/deployments.md#syncdeploymentasync).
{% endtab %}

{% tab title="PowerShell" %}

```powershell
Get-PmpcDeployment -ProductId $current.ProductId
Sync-PmpcDeployment -ProductId $current.ProductId -DeploymentId '{deployment-id}'
```

See [Sync-PmpcDeployment](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/sync-pmpcdeployment.md).
{% endtab %}
{% endtabs %}

## Related pages

* [Create a custom application](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/create-a-custom-application.md)
* [Search the catalog](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/search-the-catalog.md)
* [Deploy an application](https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/deploy-an-application.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.patchmypc.com/patch-my-pc-cloud-api/guides/update-an-application.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
