Cannot reload/recompile scripts

I’m using Unity 2017.1.0f3 with MSVC 2017 as my script editor. I disabled automatic refresh because it frequently does not detect changes. When I save a script in MSVC and manually refresh in Unity, I can see the changes in the inspector. But the old version of the script still runs when I click play! If I rebuild the project in MSVC, the old version still runs. Even exiting and restarting Unity does not help.

I’m certain that the old version is still running because it’s throwing an exception with a message that I wrote myself as a test, and subsequently removed from the code.

How do I get Unity to start using the new version of a script?

Upgrading to 2017.2.0f3 seems to have helped. Keeping my fingers crossed because it didn’t always do this with 2017.1.0f3, either.

I have noticed that Unity doesn’t like when you make rapid-fire changes to the script which sometimes causes it to not recompile the latest changes; sometimes I make a small change to the script to poke Unity into recompiling.

Another thing I’ve done when this occured was to shut down both Unity and Visual Studio, then re-open Unity and open the script, which should make it catch up and recompile.