I have a project that I am working where I have some functionality written in static classes. I want to be able to reload changes to these static classes without restarting my program to make development quicker. I tried dotnet watch, but it restarts the entire program so it doesn't really work well. I was also looking in to recompiling changed static classes with Roslyn, but it seems like the code will continue using the old static class even when the new one has been added. What is this best way to solve this problem?
Asked
Active
Viewed 14 times
0
-
1You can't unload an assembly after it is loaded, but you can [unload an AppDomain](https://stackoverflow.com/a/6258208/2791540) – John Wu Apr 05 '20 at 00:39
-
As @JohnWu said the only way to "reload" assembly is to reload AppDomain. There are plenty questions on that - I picked one as duplicate. Please note that since it is the only solution it is also "this best way to solve this problem" but you will have to heavily redesign your program to use it. – Alexei Levenkov Apr 05 '20 at 01:35