当前位置: 首页>>代码示例>>C#>>正文


C# DeploymentContext类代码示例

本文整理汇总了C#中DeploymentContext的典型用法代码示例。如果您正苦于以下问题:C# DeploymentContext类的具体用法?C# DeploymentContext怎么用?C# DeploymentContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeploymentContext类属于命名空间,在下文中一共展示了DeploymentContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateScript

        private void GenerateScript(DeploymentContext context, ILogger buildLogger)
        {
            try
            {
                using (context.Tracer.Step("Generating deployment script"))
                {
                    var scriptGenerator = new Executable(DeploymentScriptGeneratorToolPath, RepositoryPath, DeploymentSettings.GetCommandIdleTimeout());

                    // Set home path to the user profile so cache directories created by azure-cli are created there
                    scriptGenerator.SetHomePath(System.Environment.GetEnvironmentVariable("APPDATA"));

                    var scriptGeneratorCommand = String.Format(ScriptGeneratorCommandFormat, RepositoryPath, ScriptGeneratorCommandArguments);
                    buildLogger.Log(Resources.Log_DeploymentScriptGeneratorCommand, scriptGeneratorCommand);

                    scriptGenerator.ExecuteWithProgressWriter(buildLogger, context.Tracer, _ => false, _ => false, scriptGeneratorCommand);
                }
            }
            catch (CommandLineException ex)
            {
                context.Tracer.TraceError(ex);

                // HACK: Log an empty error to the global logger (post receive hook console output).
                // The reason we don't log the real exception is because the 'live output' running
                // msbuild has already been captured.
                context.GlobalLogger.LogError();

                // Add the output stream and the error stream to the log for better
                // debugging
                buildLogger.Log(ex.Output, LogEntryType.Error);
                buildLogger.Log(ex.Error, LogEntryType.Error);

                throw;
            }
        }
开发者ID:bhaveshc,项目名称:kudu,代码行数:34,代码来源:GeneratorSiteBuilder.cs

示例2: BeforeDeploy

        public override void BeforeDeploy(DeploymentContext context, Action<ProgressReport> reportProgress)
        {
            var logger = context.GetLoggerFor(this);

            // find an app_online.htm file in the package
            var appOnline = context.Package.GetFiles().SingleOrDefault(f => f.Path.EndsWith(APP_ONLINE_FILE));

            if (appOnline == null)
            {
                return;
            }

            var tempFilePath = Path.Combine(context.WorkingFolder, appOnline.Path);
            var destinationFilePath = Path.Combine(context.TargetInstallationFolder, APP_OFFLINE_FILE);

            if (!File.Exists(tempFilePath))
            {
                return;
            }

            logger.Info("Copying app_offline.htm to destination");
            reportProgress(new ProgressReport(context, GetType(), "Copying app_offline.htm to destination"));

            if (!_fileSystem.Directory.Exists(Path.GetDirectoryName(destinationFilePath)))
            {
                _fileSystem.Directory.CreateDirectory(Path.GetDirectoryName(destinationFilePath));
            }

            if (!_fileSystem.File.Exists(destinationFilePath))
            {
                _fileSystem.File.Copy(tempFilePath, destinationFilePath);
            }

            WaitForAppToUnload();
        }
开发者ID:andrewmyhre,项目名称:DeployD,代码行数:35,代码来源:AppOfflineDeploymentHook.cs

示例3: Deploy

        /// <summary>
        /// Performs a deployment.
        /// </summary>
        /// <param name="context">The deployment context.</param>
        public void Deploy(DeploymentContext context)
        {
            if (string.IsNullOrEmpty(Filename))
                return;
            var normalPath = Filename.Replace('/', Path.DirectorySeparatorChar);
            var destination = Path.Combine(context.DestinationPath, normalPath);

            Directory.CreateDirectory(Path.GetDirectoryName(destination));
            if (File.Exists(destination))
            {
                try
                {
                    File.Delete(destination);
                }
                catch
                {
                    return;
                }
            }

            try
            {
                context.ExtractFile(Filename, destination);
            }
            catch
            {
                return;
            }
        }
开发者ID:hlesesne,项目名称:Monoflector,代码行数:33,代码来源:InstallFile.cs

示例4: AfterDeploy

        public override void AfterDeploy(DeploymentContext context)
        {
            var logger = context.GetLoggerFor(this);
            if (!EnvironmentIsValidForPackage(context))
            {
                return;
            }

            // if no such service then install it
            using (var service = ServiceController.GetServices().SingleOrDefault(s => s.ServiceName == context.Package.Id))
            {
                if (service == null)
                {
                    var pathToExecutable = Path.Combine(context.TargetInstallationFolder, context.Package.Id + ".exe");
                    logger.InfoFormat("Installing service {0} from {1}", context.Package.Title, pathToExecutable);

                    System.Configuration.Install.ManagedInstallerClass.InstallHelper(new[] {pathToExecutable});
                }
            }

            using (var service = ServiceController.GetServices().SingleOrDefault(s => s.ServiceName == context.Package.Id))
            {
                // todo: recursively shut down dependent services
                if (!service.Status.Equals(ServiceControllerStatus.Stopped) &&
                    !service.Status.Equals(ServiceControllerStatus.StopPending))
                {
                    return;
                }

                ChangeServiceStateTo(service, ServiceControllerStatus.Running, service.Start, logger);
            }
        }
开发者ID:repne,项目名称:DeployD,代码行数:32,代码来源:ServiceDeploymentHook.cs

示例5: HTMLPakAutomation

    public HTMLPakAutomation(ProjectParams InParam, DeploymentContext InSC)
    {
        Params = InParam;
        SC = InSC;

        var PakOrderFileLocationBase = CommandUtils.CombinePaths(SC.ProjectRoot, "Build", SC.FinalCookPlatform, "FileOpenOrder");
        PakOrderFileLocation = CommandUtils.CombinePaths(PakOrderFileLocationBase, "GameOpenOrder.log");
        if (!CommandUtils.FileExists_NoExceptions(PakOrderFileLocation))
        {
            // Use a fall back, it doesn't matter if this file exists or not. GameOpenOrder.log is preferred however
            PakOrderFileLocation = CommandUtils.CombinePaths(PakOrderFileLocationBase, "EditorOpenOrder.log");
        }

        string PakPath = Path.Combine(new string[] { Path.GetDirectoryName(Params.RawProjectPath), "Binaries", "HTML5", SC.ShortProjectName});
        if (Directory.Exists(PakPath))
        {
            Directory.Delete(PakPath,true);
        }

        // read in the json file. 
        string JsonFile = CommandUtils.CombinePaths(new string[] { SC.ProjectRoot, "Saved", "Cooked", "HTML5", Params.ShortProjectName, "MapDependencyGraph.json" });
        string text = File.ReadAllText(JsonFile);

        DependencyJson = fastJSON.JSON.Instance.ToObject<Dictionary<string, object>>(text);

    }
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:26,代码来源:HTML5Platform.PakFiles.Automation.cs

示例6: GetFilesToArchive

    public override void GetFilesToArchive(ProjectParams Params, DeploymentContext SC)
    {
        if (SC.StageTargetConfigurations.Count != 1)
        {
            throw new AutomationException("iOS is currently only able to package one target configuration at a time, but StageTargetConfigurations contained {0} configurations", SC.StageTargetConfigurations.Count);
        }

        string PackagePath = Path.Combine(Path.GetDirectoryName(Params.RawProjectPath), "Binaries", "HTML5");
        string FinalDataLocation = Path.Combine(PackagePath, Params.ShortProjectName) + ".data";

        // copy the "Executable" to the archive directory
        string GameExe = Path.GetFileNameWithoutExtension(Params.ProjectGameExeFilename);
        if (Params.ClientConfigsToBuild[0].ToString() != "Development")
        {
            GameExe += "-HTML5-" + Params.ClientConfigsToBuild[0].ToString();
        }
        GameExe += ".js";

        // put the HTML file to the package directory
        string OutputFile = Path.Combine(PackagePath, (Params.ClientConfigsToBuild[0].ToString() != "Development" ? (Params.ShortProjectName + "-HTML5-" + Params.ClientConfigsToBuild[0].ToString()) : Params.ShortProjectName)) + ".html";

        SC.ArchiveFiles(PackagePath, Path.GetFileName(FinalDataLocation));
        SC.ArchiveFiles(PackagePath, Path.GetFileName(FinalDataLocation + ".js"));
        SC.ArchiveFiles(PackagePath, Path.GetFileName(GameExe));
        SC.ArchiveFiles(PackagePath, Path.GetFileName(GameExe + ".mem"));
        SC.ArchiveFiles(PackagePath, Path.GetFileName("json2.js"));
        SC.ArchiveFiles(PackagePath, Path.GetFileName("jstorage.js"));
        SC.ArchiveFiles(PackagePath, Path.GetFileName("moz_binarystring.js"));
        SC.ArchiveFiles(PackagePath, Path.GetFileName(OutputFile));
    }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:30,代码来源:HTML5Platform.Automation.cs

示例7: ApplyStagingManifest

    public static void ApplyStagingManifest(ProjectParams Params, DeploymentContext SC)
    {
        MaybeConvertToLowerCase(Params, SC);
        if (SC.Stage && !Params.NoCleanStage && !Params.SkipStage)
        {
            DeleteDirectory(SC.StageDirectory);
        }
        if (ShouldCreatePak(Params, SC))
        {
            if (Params.Manifests && DoesChunkPakManifestExist(Params, SC))
            {
                CreatePaksUsingChunkManifests(Params, SC);
            }
            else
            {
                CreatePakUsingStagingManifest(Params, SC);
            }
        }
        if (!SC.Stage || Params.SkipStage)
        {
            return;
        }
        DumpManifest(SC, CombinePaths(CmdEnv.LogFolder, "FinalCopy" + (SC.DedicatedServer ? "_Server" : "")), !Params.UsePak(SC.StageTargetPlatform));
        CopyUsingStagingManifest(Params, SC);

        var ThisPlatform = SC.StageTargetPlatform;
        ThisPlatform.PostStagingFileCopy(Params, SC);
    }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:28,代码来源:CopyBuildToStagingDirectory.Automation.cs

示例8: OnDeploymentTaskStarting

 public void OnDeploymentTaskStarting(DeploymentTask deploymentTask, DeploymentContext deploymentContext)
 {
     if (deploymentTask.TargetEnvironmentName == ProductionEnvironmentName
        && deploymentTask.ProjectConfigurationName != ProductionProjectConfigurationName)
       {
     throw new InvalidOperationException(string.Format("Can't deploy project ('{0}') with non-production configuration ('{1}') to the production environment!", deploymentTask.ProjectName, deploymentTask.ProjectConfigurationName));
       }
 }
开发者ID:szkra,项目名称:UberDeployer,代码行数:8,代码来源:EnforceTargetEnvironmentConstraintsModule.cs

示例9: GetFilesToDeployOrStage

    public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC)
    {
        SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Binaries", SC.PlatformDir), "*", false, null, CommandUtils.CombinePaths(SC.RelativeProjectRootForStage, "Binaries", SC.PlatformDir), false);

        if (SC.bStageCrashReporter)
        {
            SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "CrashReportClient", false);
        }
    }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:9,代码来源:LinuxPlatform.Automation.cs

示例10: HookValidForPackage

 public override bool HookValidForPackage(DeploymentContext context)
 {
     Site site;
     LocateMsDeploy(context.GetLoggerFor(this));
     var iis7SiteInstance = FindIis7Website(context.Package.Title);
     return context.Package.Tags.ToLower().Split(' ', ',', ';').Contains("website")
            && !string.IsNullOrEmpty(MsWebDeployPath)
            && TryFindIis7Website(context.Package.Id, out site);
 }
开发者ID:repne,项目名称:DeployD,代码行数:9,代码来源:Iis7MsDeployDeploymentHook.cs

示例11: BeforeDeploy

        public override void BeforeDeploy(DeploymentContext context)
        {
            var logger = context.GetLoggerFor(this);
            if (!EnvironmentIsValidForPackage(context))
            {
                return;
            }

            ShutdownRequiredServices(context, logger);
        }
开发者ID:repne,项目名称:DeployD,代码行数:10,代码来源:ServiceDeploymentHook.cs

示例12: StageExecutable

	private int StageExecutable(string Ext, DeploymentContext SC, string InPath, string Wildcard = "*", bool bRecursive = true, string[] ExcludeWildcard = null, string NewPath = null, bool bAllowNone = false, StagedFileType InStageFileType = StagedFileType.NonUFS, string NewName = null)
	{
		int Result = SC.StageFiles(InStageFileType, InPath, Wildcard + Ext, bRecursive, ExcludeWildcard, NewPath, bAllowNone, true, (NewName == null) ? null : (NewName + Ext));
		if (Result > 0)
		{
			SC.StageFiles(StagedFileType.DebugNonUFS, InPath, Wildcard + "pdb", bRecursive, ExcludeWildcard, NewPath, true, true, (NewName == null) ? null : (NewName + "pdb"));
			SC.StageFiles(StagedFileType.DebugNonUFS, InPath, Wildcard + "map", bRecursive, ExcludeWildcard, NewPath, true, true, (NewName == null) ? null : (NewName + "map"));
		}
		return Result;
	}
开发者ID:ErwinT6,项目名称:T6Engine,代码行数:10,代码来源:WinPlatform.Automation.cs

示例13: BeforeDeploy

 public override void BeforeDeploy(DeploymentContext context)
 {
     var logger = context.GetLoggerFor(this);
     var appPools = GetApplicationPoolsForWebsite(context.Package.Title);
     foreach (var appPool in appPools)
     {
         logger.InfoFormat("Stopping application pool {0}", appPool.Name);
         appPool.Stop();
     }
 }
开发者ID:repne,项目名称:DeployD,代码行数:10,代码来源:Iis7MsDeployDeploymentHook.cs

示例14: GetExecutableNames

	public override List<string> GetExecutableNames(DeploymentContext SC, bool bIsRun = false)
	{
		List<string> Exes = base.GetExecutableNames(SC, bIsRun);
		// replace the binary name to match what was staged
		if (bIsRun && !SC.IsCodeBasedProject)
		{
			Exes[0] = CommandUtils.CombinePaths(SC.StageProjectRoot, "Binaries", SC.PlatformDir, SC.ShortProjectName);
		}
		return Exes;
	}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:10,代码来源:LinuxPlatform.Automation.cs

示例15: GetFilesToDeployOrStage

	public override void GetFilesToDeployOrStage(ProjectParams Params, DeploymentContext SC)
	{
		// Engine non-ufs (binaries)

		if (SC.bStageCrashReporter)
		{
			StageExecutable("exe", SC, CommandUtils.CombinePaths(SC.LocalRoot, "Engine/Binaries", SC.PlatformDir), "CrashReportClient.");
		}

		// Stage all the build products
		foreach(TargetReceipt Receipt in SC.StageTargetReceipts)
		{
			SC.StageBuildProductsFromReceipt(Receipt);
		}

		// Copy the splash screen, windows specific
		SC.StageFiles(StagedFileType.NonUFS, CombinePaths(SC.ProjectRoot, "Content/Splash"), "Splash.bmp", false, null, null, true);

		// Stage the bootstrap executable
		if(!Params.NoBootstrapExe)
		{
			foreach(TargetReceipt Receipt in SC.StageTargetReceipts)
			{
				BuildProduct Executable = Receipt.BuildProducts.FirstOrDefault(x => x.Type == BuildProductType.Executable);
				if(Executable != null)
				{
					// only create bootstraps for executables
					if (SC.NonUFSStagingFiles.ContainsKey(Executable.Path) && Path.GetExtension(Executable.Path) == ".exe")
					{
						string BootstrapArguments = "";
						if (!SC.IsCodeBasedProject && !ShouldStageCommandLine(Params, SC))
						{
							BootstrapArguments = String.Format("..\\..\\..\\{0}\\{0}.uproject", SC.ShortProjectName);
						}

						string BootstrapExeName;
						if(SC.StageTargetConfigurations.Count > 1)
						{
							BootstrapExeName = Path.GetFileName(Executable.Path);
						}
						else if(Params.IsCodeBasedProject)
						{
							BootstrapExeName = Receipt.GetProperty("TargetName", SC.ShortProjectName) + ".exe";
						}
						else
						{
							BootstrapExeName = SC.ShortProjectName + ".exe";
						}

						StageBootstrapExecutable(SC, BootstrapExeName, Executable.Path, SC.NonUFSStagingFiles[Executable.Path], BootstrapArguments);
					}
				}
			}
		}
	}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:55,代码来源:WinPlatform.Automation.cs


注:本文中的DeploymentContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。