Allow ClickOnce to Install Multiple Published Programs from the Same Project in the Same Environment (.NET Framework Editions Only)

Page update date :
Page creation date :

Operation check environment

Visual Studio
  • Visual Studio 2022
.NET Framework
  • .NET Framework 4.8

Required Environments

  • Windows Forms (.NET Framework) in general
  • WPF (.NET Framework) in general

At first

This Tips describes how to install multiple published ClickOnce from the same project separately in the same environment.

About the procedure for publishing multiple copies from the same project in different configurations

For example, even in the same project, if the processing contents are changed depending on the build configuration, you may want to publish as a separate program. This is possible in the .NET (Core) version, but not in the .NET Framework version with the standard features of Visual Studio.

This method is summarized in the following tips using a batch program. This Tips is explained on the premise that the following contents are completed.

Conditions under which ClickOnce installs as separate applications

If you publish using the batch program described above, the build configuration is changed, but both are treated as the same application, If you try to install two in the same environment, there will be a conflict, and the installation will fail even if you try to install later.

I need to make this seem to be a separate application, but according to the referenced article, the following parameters identify the application:

Reference: (.NET) When I launch the app after publishing with ClickOnce, I get that "the placement ID does not match the subscription"

  • Application Name
  • Public Key Token
  • Culture
  • Processor architecture (for example, x86)

Among these, I think that it is undesirable to change "culture" and "processor architecture" because there is a possibility of unintended processing results.

I think that there is a way to change the "application name", Basically, it is not recommended because only one name can be given to one project. There is a possibility that multiple definitions can be made by build configuration and condition parameters in the contents of the project file, Since only one UI can be set in Visual Studio, it is a little dangerous because it may be overwritten depending on the operation.

The rest is a "public key token", but this one allows you to create multiple certificates, Since it can be specified as a parameter at the time of ClickOnce publishing, I would like to identify the application with this time.

Operation check procedure

From the point of creating the project to the point where it is ready to publish as a batch file, it is the same as the following tips, so please refer to it for the procedure up to that point.

Creating a certificate

This time, we will confirm with a test certificate for the sample. Originally, it should be done with a regular certificate, but since it will require a procedure other than the main subject such as certificate creation and certificate authority preparation, I will exclude the explanation related to certificates. In production, it is OK to replace the test certificate file with the production file.

After you create the project and create the batch for publishing, return to Visual Studio. Open the project properties and choose Sign from the menu on the left. There is a check for "Sign the ClickOnce manifest" so check it.

Now create two certificates. This time we will create it on this screen, but ". pfx" file format, there is no problem with creating certificates by other means.

There is a "Create Test Certificate" button in the lower right corner, so click it.

You can also put a password, but it works whether you put it in or not. However, if you want to put a password, the procedure will be troublesome, so I will not put it this time.

A certificate (.pfx) file has been generated for your project. The file name generated here is fixed but can be changed later. By the way, the validity of the test certificate created here is one year. After one year, you will need to recreate a new certificate.

Follow the same steps to create another one.

This time, we will publish in the Debug build and the Release build, so we will change the name to a clear one.

Batch modification

Open the batch file you created (.bat) in a text editor and add the following to the parameters of msbuild:

parameter name description required
ManifestKeyFile The file name (.pfx) of the certificate. Specify a path relative to or absolute from the project file.
ManifestCertificateThumbprint The thumbprint of the manifest certificate. The value to be put in can be anything, but it must be put in by all means.
ProductName Product name. It becomes the display name of the start menu or list of programs.
PublisherName Public company name. It becomes the folder name when organizing programs in the start menu.

Based on the above, modify the patch file as follows.

ClickOnceDebug publishes.bat (example)

call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
cd %~dp0
msbuild ClickOnceBuildConfiguration.sln /t:Publish /t:CopyPublishedApplication /p:Configuration=Debug /p:PublishUrl="publish\Debug\\" /p:InstallUrl="\\xxxxServer\publish_Debug\\" /p:ManifestKeyFile="ClickOnceMultipleInstallDebug.pfx" /p:ManifestCertificateThumbprint="Debug" /p:ProductName="CliclOnce テスト Debug システム" /p:PublisherName="Sorceryforce"

ClickOnceRelease Issue.bat (Example)

call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
cd %~dp0
msbuild ClickOnceBuildConfiguration.sln /t:Publish /t:CopyPublishedApplication /p:Configuration=Release /p:PublishUrl="publish\Release\\" /p:InstallUrl="\\xxxxServer\publish_Release\\" /p:ManifestKeyFile="ClickOnceMultipleInstallRelease.pfx" /p:ManifestCertificateThumbprint="Release" /p:ProductName="CliclOnce テスト Release システム" /p:PublisherName="Sorceryforce"

ManifestKeyFile Each value specifies a different certificate file. ManifestCertificateThumbprint The value of can be anything, but be sure to include it because the application cannot be identified as another one if you do not put it.

By the way, since two programs are installed in the same environment this time, parameters have been added so that ProductName they can be distinguished. PublisherName at your liking.


After input, execute each batch file and publish it.

If xxxx.application is in the file you published, open it in a text editor and make sure that haspublicKeyToken a different value.


After copying the published files to the public folder, run to install them setup.exe .

If you enter the certificate at the time of issuance, the following screen will be displayed at the time of installation. If it is a test certificate, the publisher can not be confirmed, so install it as it is.

The first program was installed and launched.

I'll try installing the other one.

The other one was also installed and launched.

Of course, both are working at the same time.

ProductName Since it was attached, it is displayed separately in the start menu.

You can also see both in the list of apps.