To Deploy to a Specific Web Application:
The custom timer job I was recently working on for SP2016 on prem was deployed globally in its early versions. I wanted to change it to instead target just one Web Application. I changed the Scope in the manifest to 'WebApplication', recompiled, retracted and deployed with PowerShell to the Web Application and I got the following error:
This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application
After googling for the error message, I tried the technique described here and also in this blog at the bottom. Once I added a dummy safe control, SharePoint let me target deployment to a Web Application instead of globally.
Best Practices for successful deactivation and redeploy:
I dont recommend update-spsolution either. I have always retracted/redeployed which is frustrating because it can be very time consuming. I (and other colleagues) often experience SharePoint will hang on to a previous versions of a WSP when a new version is redeployed and the old code would be executed. A colleague came up with the following best practice:
Stop all timer jobs in your farm at once, then clear the config cache, then restart all of the timer jobs. This is a painful but necessary step depending on your situation (what your code is trying to do and your Farm configuration).
The timer jobs are resilient and can get passed from server to server in your Farm depending on the server state. So its best to bring them all down to remove all doubt.
Another best practice for timer job or farm solution development is to develop and test deployment against a multi server Farm in development if possible. Often times deployment issues can be masked if you only code and deploy to a singer-server Farm.
And a final tip if your solution is in a bad state and nothing else works is to try and run the SharePoint Product Configuration Wizard on each server in the Farm. It can often repair the low level items and get you back to normal running state.