Skip to content

This source code demonstrates how to publish an app using ClickOnce with multiple environments profile and install both apps in computer at the same time.

Notifications You must be signed in to change notification settings

smriti2901/ClickOnce-DevProd-Publish-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to deploy multi-environment app using ClickOnce Publish Profiles for Dev and Prod

This source code demonstrates how to publish an app using ClickOnce with multiple environments profile and install both apps in computer at the same time.

Steps to set up different behaviour for Dev and Prod app

1. Setup different build configurations for Dev and Prod [Optional]

Create new profile Dev which is a copy of Debug and Prod which is a copy of Release. This is only done for demo purpose. This can be used by Debug or Release configurations as well. Helpful, in cases where different behaviour is needed for different build configurations. Otherwise,

image

2. Setup conditional symbols for DEV [Optional]

In order to display different console message when both apps are run set conditional symbol DEV for Dev build configuration. This step is optional and only needed to test if the app you are running is running with Dev profile or from Prod profile.

image

After this you can use it in Program.cs

#if DEV
Console.WriteLine("Hello, World! (Dev)");
#else
Console.WriteLine("Hello, World! (Prod)");
#endif

Console.WriteLine("Press any key to exit.");
Console.ReadKey();

3. Set different assembly names in the .csproj file

If using Debug and Release configurations then .csproj file should be edited accordingly.

image

4. Setup environment specific publish profiles

In this demo we will publish the exe on our local machine in different folders for Dev and Prod.

image

  1. Set the Publish Location

    image
  2. Set the option for Users to get application from

image

  1. Set the Auto increment of versions and set Publisher name and Product name to differentiate between Dev and Prod app during installation and in Control panel.
image image

Follow, same steps with Prod profile.

image

image

  1. Once the profiles are set Publish both apps in Publish Wizard. After publish both exe will be available in their respective folders.

image

image

5. Output of the installation and execution of the app

When the apps are intalled we see two different apps in the Control Panel for Dev and Prod. This allows us to run the apps simultaneously without overriding / uninstalling the other.

image

After running the apps it displays message based on the app.

image image

About

This source code demonstrates how to publish an app using ClickOnce with multiple environments profile and install both apps in computer at the same time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages