EasyAbp / AbpHelper.CLI

Providing code generation and more features to help you develop applications and modules with the ABP framework.
MIT License
285 stars 95 forks source link

Support for differing solution name #218

Closed nebula2 closed 1 year ago

nebula2 commented 1 year ago

The current logic in EnsureSlnFileExists.EnsureSlnFileExists expects the solution name in a specific format.

When your setup differs from that, the cli is not really usable due to FileNotFoundException getting thrown.

For example: You have a Domain-Project named Company.Module.Domain but your solution is named company-module.sln

It would be cool to have an option to one of the following

in the meantime, I altered the code to this

private void EnsureSlnFileExists(WorkflowExecutionContext context, string projectName)
        {
            string aspNetCoreDir = context.GetVariable<string>(VariableNames.AspNetCoreDir);
            string slnFile = Path.Combine(aspNetCoreDir, $"{projectName}.sln");

            var candidates = Directory.GetFiles(aspNetCoreDir, "*.sln");

            if (!File.Exists(slnFile) && candidates.Length != 1)
            {
                throw new FileNotFoundException(
                    $"The solution file '{projectName}.sln' is not found in '{aspNetCoreDir}'. Make sure you specific the right folder.");
            }
        }

And it does not seem to have any negative impact - but I only used controller generation at the moment

gdlcf88 commented 1 year ago

AbpHelper is made for solutions generated by the startup template. We cannot provide configurations for all customs since it would make AbpHelper hard to use. If you have customized guidelines, fork this project may be a good way.

nebula2 commented 1 year ago

Thank you, will do :)