Showing results for 
Search instead for 
Did you mean: 

Is it possible to close a running application from code?


I'm trying to automate an application update process with users running a compiled version of the application. I have code to validate the appliction version number (a property that I set) against the current version number stored in a database. It runs on the RsEngineer_AfterLoad event. I'd like to:

- display a message to the user that their code is obsolete

- copy the new DLL from a network share down to the client machine

- force the running application to close

I tried Application.Exit() but it had no effect.


Thanks for any suggestions.


Re: Is it possible to close a running application from code?

Valued Contributor
Valued Contributor


Maybe you can try using something like Model.Unload()  or LineItem.Close() methods available in modelservice?

(If something like this is available in RsEngineer on runtime?)


Other workaround that comes to my mind is to hide all process steps if version is not up to date and show only one with message (so no action would be possible and user will have to close and update).


You can also try to write a launcher (small application that will check if DLLs are up to date and update from shared drive if not) and link it to Engineer shortcuts on user PCs.

In that case each time user will run shortcut launcher will start and update DLLs before starting Engineer.

The only problem in this case is if update will be published when RS application is running.


Re: Is it possible to close a running application from code?


In the past but not using Rulestream we did this but we had a wrapper around the executable.  So you can write a .Net wrapper that checks the version and updates it if out of date then kicks off the Rulestream Engineer executable.