private void OnExecute()
        {
            IDictionary <string, Cmdlet> newModule;

            try
            {
                newModule = PSModuleAnalyzer.Analyze(NewAssemblyPath);
            }
            catch (Exception e)
            {
                throw new Exception($"Error while opening new assembly", e);
            }

            if (string.IsNullOrWhiteSpace(OldAssemblyPath))
            {
                if (string.IsNullOrWhiteSpace(ModuleName) || string.IsNullOrWhiteSpace(AssemblyFileName) || string.IsNullOrWhiteSpace(DownloadFolder))
                {
                    throw new Exception($"Either --{OldAssemblyPathOptionName} or --{ModuleNameOptionName}, --{DownloadFolderOptionName} and --{AssemblyFileNameOptionName} must be specified");
                }

                try
                {
                    OldAssemblyPath = DownloadModule(ModuleName, string.IsNullOrWhiteSpace(ModuleVersion) ? null : ModuleVersion, AssemblyFileName, DownloadFolder);
                }
                catch (Exception e)
                {
                    throw new Exception($"Error while downloading previous module version", e);
                }
            }

            IDictionary <string, Cmdlet> oldModule;

            try
            {
                oldModule = PSModuleAnalyzer.Analyze(OldAssemblyPath);
            }
            catch (Exception e)
            {
                throw new Exception($"Error while opening new assembly", e);
            }

            string sdkNewVersion;

            try
            {
                sdkNewVersion = GetSDKVersion(VersionFilePath);
            }
            catch (Exception e)
            {
                throw new Exception($"Error while reading SDK version", e);
            }

            CreateReleaseNotes(newModule, oldModule, sdkNewVersion);
        }
        private void OnExecute()
        {
            IDictionary <string, Cmdlet> newModule;

            try
            {
                Console.WriteLine($"Start analysing new assembly: {NewAssemblyPath}");
                newModule = new PSModuleAnalyzer(NewAssemblyPath).Analyze();
            }
            catch (Exception e)
            {
                throw new Exception($"Error while opening new assembly", e);
            }

            if (string.IsNullOrWhiteSpace(OldAssemblyPath))
            {
                if (string.IsNullOrWhiteSpace(ModuleName) || string.IsNullOrWhiteSpace(AssemblyFileName) || string.IsNullOrWhiteSpace(DownloadFolder))
                {
                    throw new Exception($"Either --{OldAssemblyPathOptionName} or --{ModuleNameOptionName}, --{DownloadFolderOptionName} and --{AssemblyFileNameOptionName} must be specified");
                }

                try
                {
                    OldAssemblyPath = DownloadModule(ModuleName, string.IsNullOrWhiteSpace(ModuleVersion) ? null : ModuleVersion, AssemblyFileName, DownloadFolder);
                }
                catch (Exception e)
                {
                    throw new Exception($"Error while downloading previous module version", e);
                }
            }

            IDictionary <string, Cmdlet> oldModule = null;

            try
            {
                Console.WriteLine($"Start analysing old assembly: {OldAssemblyPath}");
                oldModule = new PSModuleAnalyzer(OldAssemblyPath).Analyze();
            }
            catch (Exception e)
            {
                // TODO: Better handle when new SDK versions have removed types that failed to resolve with old PowerShell Assembly.
                Console.WriteLine($"Error while opening old assembly: {e}");
            }

            string sdkNewVersion;

            try
            {
                sdkNewVersion = GetSDKVersion(VersionFilePath);
            }
            catch (Exception e)
            {
                throw new Exception($"Error while reading SDK version", e);
            }

            string report;

            if (oldModule != null)
            {
                report = CreateReleaseNotes(newModule, oldModule, sdkNewVersion);
            }
            else
            {
                // If we failed to load the old powershell metadata then generate a default release notes.
                report = CreateErrorReleaseNotes();
            }
            Console.WriteLine(report);

            if (!string.IsNullOrWhiteSpace(OutputFilePath))
            {
                var fullOutputPath = Path.GetFullPath(OutputFilePath);
                Console.WriteLine($"Writing report to {fullOutputPath}");
                File.WriteAllText(fullOutputPath, report);
            }
        }