Solution 3 is almost OK (for EPPlus 4.5.3.3).
After opening Visual Basic you can see that Module1 is not put inside "Modules" but inside "Microsoft Excel Objects" along with sheets. Because of this macros are not seen as executable from within Excel (like after pressing Alt+F8).
Here you can see modification that puts Module1 where it should be:
var xlPack = new ExcelPackage(excelFile);
xlPack.Workbook.CreateVBAProject();
var module = xlPack.Workbook.VbaProject.Modules.AddModule("Module1");
module.Code = "Sub countMacro()\r\n ... Place Code Here ... \r\nEnd Sub\r\n";
BTW. I recommend to put macro code in .NET resources and load it:
var embeddedProvider = new EmbeddedFileProvider(Assembly.GetExecutingAssembly());
using (var reader = embeddedProvider.GetFileInfo("Resources/ExcelMacros.vb").CreateReadStream())
using (var textReader = new StreamReader(reader))
{
xlPack.Workbook.CreateVBAProject();
var module = xlPack.Workbook.VbaProject.Modules.AddModule("Module1");
module.Code = textReader.ReadToEnd();
}