Make OptimizeCommand backward compatible

Changed new implementation in OptimizeCommand to be backward compatible with old versions of the framework that do not specify providers or files in the compile config