Inheritance security rules violated by type: Microsoft.Dynamics.Nav

If you get the following error:

Unhandled Exception: System.TypeLoadException: Inheritance security rules violated by type: 'Microsoft.Dynamics.Nav.WindowsServices.NavServerWindowsService'. Derived types must either match the security accessibility of the base type or be less accessible.
   at Microsoft.Dynamics.Nav.WindowsServices.DynamicsNavServer.Main(String[] args)

Then you have properly (as I did) updated your service tier with files from a zip file, that Windows Server 2012 have decided that are unsafe and need to be blocked. I got the error after a quick update of Microsoft Dynamics NAV 2017 to CU4.

The solution is easy, fire up PowerShell, and run the following command in the folders where you copied files:

dir -Recurse | Unblock-File

Then everything should work again 🙂