I notice that it's possible to publish a .net core 5 console application with ClickOnce using Visual Studio.
TLDR; The whole point of a console application is to be able to invoke it on the commandline with command options/args entered by the user. The fact that ClickOnce allows me to publish a console application leads me to believe this is possible, but ClickOnce seems to work against this use-case by obscuring the actual path of the exe. How do I work around this?
Details
I can use ClickOnce to deploy a Console App and it works, but application is only findable from the Windows Start Menu. The application can't (easily?) be invoked from the commandline because its location is not in the user's path environment variable. As you may know, clickonce puts a shortcut to the executable in the Start Menu...
C:\users\<user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\<ConsoleApp>.appref-ms
Where the <ConsoleApp>.appref-ms is an application reference that points back to the installer's UNC filepath. If I understand correctly, clickonce does install the application on the user's machine, but obscures location/filepath of the actual executable. You're basically forced to use the application reference to launch ClickOnce Applications.
This is fine for wpf applications because those are launched from the Start Menu. But what about console applications?
The console application I am writing requires options/arguments supplied by the user. If it's just in the start menu, it will get launched and run without any options/args. Moreover, it gets launched in a NEW console window. This makes the console app (when deployed in this way) useless as just another command that's available for user to execute when they're in powershell doing other stuff.
Questions
- Is there a low friction way to deploy a console application using ClickOnce, and have its filepath added to the user's PATH env variable during install and also have it run without launching a new console window?
- Is ClickOnce the wrong tool for commandline app deployment? If not, what is the right tool?
- What's the point of a Console app that is only launchable from the Start-menu and can't have args/options?