Is it bad that I use a static field? Other application instances are expected to use the same _applicationPath.
I do not think this is bad. As long as this field is private, you can use it however you want. Just be careful not to change it after you install it during deployment.
Is this an example of a violation of the SRP principle (SOLID)? And should I extract the "deployment responsibility" to another class?
Yes, I would definitely reorganize it and separate the deployment from the application launch. Currently, your class does more than one, it starts the process and deploys the application:
class Application { private Process _process; private static string _applicationPath; public void Start(string arguments) { var isDeployed = string.IsNullOrEmpty(_applicationPath); if (!isDeployed) { var deployment = new Deployment(); _applicationPath = deployment.Deploy(); } _process = Process.Start(_applicationPath, arguments); } public void SomeMethod() {
source share