Exemple #1
0
        public sealed override void GenerateCode()
        {
            FrameworkDependencyStatus dependencyStatus = FrameworkDependencyStatus.InstallNotNeeded;

            if (Framework.IsDependencyInstalled(Context))
            {
                Context.AddTelemetryData(TelemetrySharedKeys.DependencyScaffolderOptions, (uint)DependencyScaffolderOptions.AlreadyInstalled);
            }
            else
            {
                dependencyStatus = Framework.EnsureDependencyInstalled(Context);
            }

            Scaffold();

            if (dependencyStatus.IsNewDependencyInstall)
            {
                Framework.UpdateConfiguration(Context);
            }

            if (Model.OutputFileFullPath != null)
            {
                VisualStudioIntegration.Editor.OpenFileInEditor(Model.OutputFileFullPath);
            }

            // The readme is opened after the output file if needed, we want it to stay on top
            if (dependencyStatus.IsReadmeRequired)
            {
                VisualStudioIntegration.Editor.CreateAndOpenReadme(dependencyStatus.ReadmeText);
            }

            // Settings are only saved if scaffolding is successful
            SaveSettings(Model);

            // Adding the list of all the runtime dependency packages to the Context. Scaffolding core will install these
            // dependencies after the GenerateCode function is executed.
            foreach (NuGetPackage package in RuntimePackages)
            {
                Context.Packages.Add(package);
            }
        }
 protected override FrameworkDependencyStatus GenerateConfiguration()
 {
     return(FrameworkDependencyStatus.FromReadme(ODataReadMe.CreateReadMeText()));
 }