Can't add scripts - "Can't add script behaviour VisualContainerAsset. The script needs to derive from MonoBehaviour!"

I can’t add any scripts to my assets and in-scene objects in a 2018.1.1f1 project. This includes out of-the-box tutorial scripts, as well as empty test scripts generated through Add Component > New Script, ie:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class test : MonoBehaviour {

	// Use this for initialization 	void Start () {
		 	} 	 	// Update is called once per frame 	void Update () {
		 	} }

All result in the error pop-up “Can’t add script behaviour VisualContainerAsset. The script needs to derive from MonoBehaviour!”

Similar problems are discussed here , suggesting it’s a bug. This seems like a pretty major bug to go unresolved for so long…
What is happening here, and how can I resolve it?

Same issue. After my computer crashed while unity was open, NONE of my projects worked any longer. Every scripts I tried to add would display the AssemblyInfo.cs error and ALL of my prefabs said they had missing scripts. What I did was read through the errors on the console specifically, and fix those specific files.

I had to fix the broken script in the red error of each project. Look at your console log for details and specifically address the issue displayed their. Once i did that, everything worked again.