Error building Player because scripts had compiler errors when packaging ab package

The Error Building Player because scripts had Compiler errors occurred when packing AB packages

Generally occur when the problem mostly using UnityEditor namespace, solution is new and the Editor folder put the script in the space, but for ab to check the packaging can be more than just a namespace, please note that the Editor folder you script the macro definition of whether to use the UNITY_EDITOR or UNITY_EDITOR_WIN two macro definition, if you are using the macro definition is then packaged ab package when also can appear similar problem.
Just try UNITY_STANDALONE_WIN Windows and UNITY_STANDALONE_OSX or just UNITY_STANDALONE_OSX alone if you just want to test it on the Win or Mac platform

Read More: