I have an application that, due to its nature, needs to be run after business hours so as not to interrupt the workflow of the users. I have downloaded and added a reference to Microsoft.Win32.TaskScheduler.dll, as per recommendation on another question regarding the best way to schedule a task to run later that day.
In debugging, the program works as expected, however when deploying, I get the following error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Win32.TaskScheduler, Version=2.5.16.0, Culture=neutral, PublicKeyToken=0d013ddd5178a2ae' or one of its dependencies.
This leads me to believe that the dll is not being added to the executable correctly when it's being built.
Steps I've taken to resolve this:
- In the solution explorer, ensured Microsoft.Win32.TaskScheduler Copy Local property is True
- Project Properties, Publish, Application Files - Microsoft.Win32.TaskScheduler.dll Include in publish, Download Required, Include Hash
- Remove dependency and re-add
- Followed the suggestions in this answer
All have, at this point, failed. I can confirm that the .dll is in the /bin/debug folder as it should be. Additionally, I manually added System.Management.Automation
the same way, and it appears to function as expected.
If anyone has any additional suggestions, it would be appreciated.