Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Published version WPF .NET Core

I am looking to use the format as below, but in a .net core WPF C# application. Here is how I used to use it.

public static string GetVersion()
{
   if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
   {
      Version myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion;
      return $"Version {myVersion}";
   }
   return "Version not deployed";
}

Is there a matching process in .net core please? Thanks

like image 446
scottsanpedro Avatar asked Oct 15 '22 22:10

scottsanpedro


1 Answers

There is a closed issue around this issue and ClickOnce deployment.

ApplicationDeployment class is not available - that class is implemented in System.Deployment assembly that is not part of .NET Core 3.1 or .NET 5.

We will have a way to expose some of the properties that the class enables, i.e. URL parameters and update status. But, that work could not be completed for .NET 5 release. We will enable it in one of .NET 6 previews. Here are the tracking issues: #27 and #53

Use of ApplicationDeployment class in your deployed ClickOnce application is not possible, but main ClickOnce experience is available. It includes: creating ClickOnce deployment (manifests), publishing the application, creating and publishing updates. Your application will get automatic update check (and update, if user accepts it) - this part is handled by ClickOnce runtime and the new Launcher tool that becomes the entry point of ClickOnce deployment for .NET Core 3.1 and .NET 5 applications.

Consequently, as for now there does not seem to be a way to do this in .NET Core directly.

like image 155
thatguy Avatar answered Oct 18 '22 22:10

thatguy