How to create a ClickOnce project in VS 2022 and .NET 7?

185 Views Asked by At

I have a c# ClickOnce project written in VS 2019 with .NET framework 4.7.2. It uses the code described in the link:

https://learn.microsoft.com/en-us/visualstudio/deployment/how-to-check-for-application-updates-programmatically-using-the-clickonce-deployment-api?view=vs-2022&tabs=csharp

With this code the application can check for updates programmatically. It works just fine!

Now, I want to step up to Visual Studio 2022. I know you can still use .NET Framework 4.7.2, but there seems to be a possibility to step up also the .NET version (here: to .NET 7), through the link:

https://learn.microsoft.com/en-us/visualstudio/deployment/access-clickonce-deployment-properties-dotnet?view=vs-2022

Meaning, you should be able to use .NET 7 to do the job. But, how to transform the code needed from the first link into the second one? I don't get it. Has anyone done this?

1

There are 1 best solutions below

4
Node defender On BEST ANSWER

The link provided by Hans Passant was very helpful: https://github.com/dotnet/deployment-tools/blob/main/Documentation/dotnet-mage/ApplicationDeployment.cs

Here is my understanding of these properties:

IsNetworkDeployed: Get the network deployment status based on environment variables.

CurrentDeployment: If network deployment is true, get the current deployment; otherwise, return null.

ActivationUri: Gets the activation URI if available.

CurrentVersion: Get the current version based on environment variables.

DataDirectory: Get the data directory path based on environment variables.

IsFirstRun: Get the first run status based on environment variables.

TimeOfLastUpdateCheck: Get the time of the last update check based on environment variables.

UpdatedApplicationFullName: Get the full name of the updated application based on environment variables.

UpdatedVersion: Get the updated version based on environment variables.

UpdateLocation: Gets the update location URI if available.

LauncherVersion: Get the launcher version based on environment variables.

These properties can be updated very easily if you understand them.