public async System.Threading.Tasks.Task GenerateAsync(string outputPath, Project project, GenerationType generationType)
        {
            try
            {
                if (string.IsNullOrEmpty(outputPath))
                {
                    throw new ArgumentException(outputPath, nameof(outputPath));
                }

                if (project.Properties.Item("TargetFrameworkMoniker") == null)
                {
                    EnvDteHelper.ShowError("The selected project type has no TargetFrameworkMoniker");
                    return;
                }

                if (!project.IsNetCore30OrHigher())
                {
                    EnvDteHelper.ShowError("Only .NET Core 3.0+ projects are supported - TargetFrameworkMoniker: " + project.Properties.Item("TargetFrameworkMoniker").Value);
                    return;
                }

                var result = await project.ContainsEfCoreDesignReferenceAsync();

                if (string.IsNullOrEmpty(result.Item2))
                {
                    EnvDteHelper.ShowError("EF Core 3.1 or later not found in project");
                    return;
                }

                if (!result.Item1)
                {
                    if (!Version.TryParse(result.Item2, out Version version))
                    {
                        EnvDteHelper.ShowError($"Cannot support version {result.Item2}, notice that previews have limited supported. You can try to manually install Microsoft.EntityFrameworkCore.Design preview.");
                        return;
                    }
                    var nugetHelper = new NuGetHelper();
                    nugetHelper.InstallPackage("Microsoft.EntityFrameworkCore.Design", project, version);
                    EnvDteHelper.ShowError($"Installing EFCore.Design version {version}, please retry the command");
                    return;
                }

                var processLauncher = new ProcessLauncher(project);

                var processResult = await processLauncher.GetOutputAsync(outputPath, generationType, null);

                if (string.IsNullOrEmpty(processResult))
                {
                    throw new ArgumentException("Unable to collect model information", nameof(processResult));
                }

                if (processResult.StartsWith("Error:"))
                {
                    throw new ArgumentException(processResult, nameof(processResult));
                }

                var modelResult = processLauncher.BuildModelResult(processResult);

                switch (generationType)
                {
                case GenerationType.Dgml:
                    GenerateDgml(modelResult, project);
                    Telemetry.TrackEvent("PowerTools.GenerateModelDgml");
                    break;

                case GenerationType.Ddl:
                    var files = project.GenerateFiles(modelResult, ".sql");
                    foreach (var file in files)
                    {
                        _package.Dte2.ItemOperations.OpenFile(file);
                    }
                    Telemetry.TrackEvent("PowerTools.GenerateSqlCreate");
                    break;

                case GenerationType.DebugView:
                    var views = project.GenerateFiles(modelResult, ".txt");
                    foreach (var file in views)
                    {
                        _package.Dte2.ItemOperations.OpenFile(file);
                    }
                    Telemetry.TrackEvent("PowerTools.GenerateDebugView");
                    break;

                default:
                    break;
                }
            }
            catch (Exception exception)
            {
                _package.LogError(new List <string>(), exception);
            }
        }
        public async System.Threading.Tasks.Task GenerateAsync(string outputPath, Project project, GenerationType generationType)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                if (string.IsNullOrEmpty(outputPath))
                {
                    throw new ArgumentException(outputPath, nameof(outputPath));
                }

                if (await project.GetAttributeAsync("TargetFrameworkMoniker") == null)
                {
                    VSHelper.ShowError(SharedLocale.SelectedProjectTypeNoTargetFrameworkMoniker);
                    return;
                }

                if (!await project.IsNetCore31OrHigherAsync())
                {
                    VSHelper.ShowError($"{SharedLocale.SupportedFramework}: {await project.GetAttributeAsync("TargetFrameworkMoniker")}");
                    return;
                }

                var result = await project.ContainsEfCoreDesignReferenceAsync();

                if (string.IsNullOrEmpty(result.Item2))
                {
                    VSHelper.ShowError(SharedLocale.EFCoreVersionNotFound);
                    return;
                }

                if (!Version.TryParse(result.Item2, out Version version))
                {
                    VSHelper.ShowError(string.Format(ModelAnalyzerLocale.CurrentEFCoreVersion, result.Item2));
                }

                if (!result.Item1)
                {
                    var nugetHelper = new NuGetHelper();
                    await nugetHelper.InstallPackageAsync("Microsoft.EntityFrameworkCore.Design", project, version);

                    VSHelper.ShowError(string.Format(SharedLocale.InstallingEfCoreDesignPackage, version));
                    return;
                }

                var processLauncher = new ProcessLauncher(project);

                var processResult = await processLauncher.GetOutputAsync(outputPath, generationType, null);

                if (string.IsNullOrEmpty(processResult))
                {
                    throw new ArgumentException(ModelAnalyzerLocale.UnableToCollectModelInformation, nameof(processResult));
                }

                if (processResult.Contains("Error:"))
                {
                    throw new ArgumentException(processResult, nameof(processResult));
                }

                var modelResult = processLauncher.BuildModelResult(processResult);

                switch (generationType)
                {
                case GenerationType.Dgml:
                    await GenerateDgmlAsync(modelResult, project);

                    Telemetry.TrackEvent("PowerTools.GenerateModelDgml");
                    break;

                case GenerationType.Ddl:
                    var files = project.GenerateFiles(modelResult, ".sql");
                    foreach (var file in files)
                    {
                        await VS.Documents.OpenAsync(file);
                    }
                    Telemetry.TrackEvent("PowerTools.GenerateSqlCreate");
                    break;

                case GenerationType.DebugView:
                    var views = project.GenerateFiles(modelResult, ".txt");
                    foreach (var file in views)
                    {
                        await VS.Documents.OpenAsync(file);
                    }
                    Telemetry.TrackEvent("PowerTools.GenerateDebugView");
                    break;

                default:
                    break;
                }
            }
            catch (Exception exception)
            {
                _package.LogError(new List <string>(), exception);
            }
        }