I have a Windows Forms app that is deployed through ClickOnce. In the app, I take advantage of the application settings to store basic connection information. In the two years and 200+ updates since I've published the app and it's been in daily use, I've had no problems with individual users modifying their own settings, and having those settings retained when the application is relaunched and updated.
However, I am working on adding a feature into the app that allows for certain tasks to be scheduled in the Task Scheduler. Everything works fine (the task is scheduled, and the application is called with the correct parameters passed) however when the program is launched, the settings are not read.
I can replicate this by manually launching the application directly from the command line. The application opens, but the only settings available are the settings that shipped with the application initially.
My end question is this: How can I call my ClickOnce app from the command line and have it open the same way as if I'd launched it from the start menu?
Thanks!!
Looks like the answer is to point the Task Scheduler to launch the .appref-ms file that is found in the start menu shortcut. You can't just point to the .exe file.
This is most likely caused by the Command line launching the ClickOnce App under a different user.
Try launching the ClickOnce from Command line or Task scheduler, and loading up task manager and seeing which user the app is running. If it is running on a user other than the user you are logged in as, then you can either log in as the user it is running under (if it's not a system user) and setting what settings you want, or you could try impersonating the desired user through task scheduler.
If none of that is applicable, you could add a Command line switch that, if no settings are found, saves a set of default settings that match what you want.
Related
The bundled XPC Service in my macOS application need to do some post processing work with files dumped by the parent app, which most probably can't be completed within the usage time of the application. So, Is there a way to make the XPC service keep running even after the user quits the main app?
You could install it as launch daemon (running in root context as long as computer is switched on) or as launch agent (running in user context as long as user is logged in).
It sounds like you should be using the WatchPaths or QueueDirectories feature of launchd.
WatchPaths starts the job whenever any of the paths being watched have changed
or
QueueDirectories starts your job whenever the given directories are non-empty, and it keeps your job running as long as those directories are not empty
Both of these are covered by Apple's launchd documentation.
I have developed a wpf app and want it to run whenever the computer starts up.However I have been unable to do so......I have tried editing registry like this answer...
Launch Window on Windows startup
Interesting thing is the app does autostart when there is internet connection.It doesn't when there is no internet. I do need internet connection at some point of time to sync the data to internet application. However this should not have affected the startup of the application.
Any ideas???
I guess you can set up a timer, and after several minutes, check out your internet, if the internet is ok, then run your application continuely. If not, reset the timer, and check again.
Go to the run line (Windows + R). Type "shell:common startup" press "enter". Place a shortcut in that folder and restart your machine (depending on what the *.exe is doing you may need to set its properties to run as administrator).
I have an offline WPF application deployed through Clickonce. I want this application to start when the windows computer starts up. Currently i'm trying to do this through Task Scheduler and have made some progress.
My program is accepting a parameter through launching the app through Task Scheduler and I can see that it is launching on StartUp and it is doing work because Task scheduler reports the task running, it processes incoming files; and the application is also logging correctly with no unexpected errors.
My problem is that although the program is executing; the view I am creating is not appearing to the user. The view contains information that can alert the user if there is an error and the application needs manually restarted, which they can do through the desktop application shortcut.
If the application is launched via the command line in the exact same way as the Task Scheduler the view shows correctly.
where can I look to find out why the view is not showing although the program is executing, or how can I get my view to show when the application has been launched At Startup
Just to clarify, if the deployed application is run by being clicked on, the command line, or even through manually starting the task in task scheduler the view will show correctly. only when the application starts At Startup does the view not show on the desktop.
I am using a Windows Service to run my batch file on scheduled times. The batch file runs an .exe file that is a Console application that simply shows a message and creates a file on a folder. When I run this program manually, the program works and the file is created. But when I try to run the program via my Windows Service the program crashes (or in some cases it asks for permission which is not good).
If I do not use the Console in my program however (nothing shown to the user and everything done in the background), the file is correctly created. I need to make sure that the service runs my .exe/.bat files but it looks like running executable files are a bit risky with services.
Is there a way to solve this problem or should I change my program so that it only does things in the background and does not display anything?
Is your service being run in the LocalSystem account -- the default for all Windows Services? If so, then your console application is being launched in that same account, where it may not be able to find its settings.
Try providing your Windows account on the service's Log On tab to see if that gets around the problems. Be sure to set an account where the console application runs normally!
A WinForms program I have developed prints fine and as expected when run as an interactive user. Using the same account but as a scheduled task, the process will run correctly however it prints part of the output in the incorrect font.
The program is a label printer that prints updated pricing labels. It has an option (-s) that the Task Scheduler calls which does not present the GUI but does an update and prints. Executing this as an interactive user through run works correctly (i.e. the correct font is used).
Any clues as to what's happening here? The font that isn't printing correctly is a non-standard system font.
This runs on a server and I thought it might be due to printer redirection but I did a console logon and it worked fine as an interactive process on the console just as it does as interactive through remote desktop.
Interesting problem. Presumably, Windows doesn't load fonts into the non-interactive logon sessions in order to conserve resources.
See this answer for one approach, using the ps tool to create an interactive session when running the task.
I had a very similar issue to yours (running an application through a scheduled task would use the default font but when running locally it would find the custom font I installed) and I found a solution; On Server 2008, there is an issue where custom fonts are not registered immediately after installing for non-interactive users, whereas regular users (i.e. when running on a user actually logged in to the machine) do have the font registered immediately.
The solution that worked for me was to simply restart the machine the font was installed on and the font started working under the non-interactive accounts, as when the computer is turned on it registers correctly. It appears the font installation has a bug where it doesn't register the font correctly for non-interactive users until a reboot.