Beispiel #1
0
        internal static void Build(Project project)
        {
            if (project.Prerequisites.Value is null || !project.Prerequisites.Value.Any())
            {
                return;
            }

            var location = project.PrerequisitesLocation.Value?.ToLowerInvariant() switch
            {
                "vendor" => "HomeSite",
                "deployment" => "Relative",
                _ => "Absolute"
            };

            var url = location == "Absolute" ? new Uri(project.PrerequisitesLocation.Value, UriKind.Absolute).AbsoluteUri : null;

            var bootstrapper = new GenerateBootstrapper
            {
                ApplicationFile    = project.DeploymentManifestFile.Value,
                ApplicationName    = project.Product.Value,
                ApplicationUrl     = project.DeploymentUrl.Value,
                ComponentsLocation = location,
                ComponentsUrl      = url,
                Path              = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Bootstrapper"),
                OutputPath        = project.Target.RootedPath,
                BootstrapperItems = project.Prerequisites.Value.Select(p => new TaskItem(p)).ToArray(),
                Validate          = true
            };

            Logger.Normal(Messages.Build_Process_Bootstrapper);
            bootstrapper.Execute();
            Logger.Normal(Messages.Result_Done, 1, 2);
        }
    }
        private static void CreateBootstrapper(string applicationFile, string applicationName, string installLocation, string publishDir)
        {
            GenerateBootstrapper bootStrapper = new GenerateBootstrapper();

            bootStrapper.ApplicationFile = applicationFile;
            bootStrapper.ApplicationName = applicationName;
            bootStrapper.ApplicationUrl  = installLocation;

            // bootStrapper.BootstrapperItems="@(BootstrapperFile)";
            bootStrapper.OutputPath = publishDir;
            bootStrapper.Execute();
        }
Beispiel #3
0
        private bool GenerateSetupEXE(string productName, string applicationPath, string bootstrapperItem)
        {
            GenerateBootstrapper gbs = new GenerateBootstrapper();
            TaskItem             taskItem;

            try {
                gbs.ApplicationName    = productName;
                gbs.ApplicationFile    = Path.GetFileName(applicationPath);// application executed after installing prerequisites
                taskItem               = new TaskItem(bootstrapperItem);
                gbs.BootstrapperItems  = new ITaskItem[] { taskItem };
                gbs.Path               = Common.BootstrapperPath;
                gbs.ComponentsLocation = ComponentsLocation.Relative.ToString();
                gbs.CopyComponents     = true;
                gbs.OutputPath         = Path.GetDirectoryName(applicationPath);
                gbs.Execute();
            } catch (Exception ex) {
                Logger.ApplicationLog(new LogMessage("Failed to generate bootstrapper", ex));
                return(false);
            }
            return(true);
        }