• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DeploymentContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Deploy

 /// <summary>
 /// Performs a deployment.
 /// </summary>
 /// <param name="context">The deployment context.</param>
 public void Deploy(DeploymentContext context)
 {
     var id = context.PluginDefinition.PluginIdentity;
     var ctx = context.PluginConfiguration.GetContext(ExportContext);
     var item = ctx.PluginExports.Where(x => string.Compare(id, x.PluginIdentity) == 0).FirstOrDefault();
     if (item == null)
         ctx.PluginExports.Add(item = new PluginExportConfiguration() { PluginIdentity = id });
     item.IsActive = true;
     if (!item.ExportProviders.Contains(Filename))
         item.ExportProviders.Add(Filename);
 }
开发者ID:hlesesne,项目名称:Monoflector,代码行数:15,代码来源:ActivateExportProvider.cs


示例17: ProgressReport

 public ProgressReport(DeploymentContext deploymentContext, Type reportingType, string packageId, string version, string installationTaskId, string message, string level="Info", Exception exception=null)
 {
     Level = level;
     PackageId = packageId;
     Version = version;
     InstallationTaskId = installationTaskId;
     Message = message;
     Exception = exception;
     Context = deploymentContext;
     ReportingType = reportingType;
 }
开发者ID:repne,项目名称:DeployD,代码行数:11,代码来源:ProgressReport.cs


示例18: Deploy

    public override void Deploy(ProjectParams Params, DeploymentContext SC)
    {
        string AdbCommand = GetAdbCommand(Params);
        string ApkName = GetFinalApkName(Params, SC.StageExecutables[0], false);
        string DeviceObbName = GetDeviceObbName(ApkName);
        string PackageName = GetPackageInfo(ApkName, false);

        // install the apk
        string UninstallCommandline = AdbCommand + "uninstall " + PackageName;
        RunAndLog(CmdEnv, CmdEnv.CmdExe, UninstallCommandline);

        string InstallCommandline = AdbCommand + "install \"" + ApkName + "\"";
        RunAndLog(CmdEnv, CmdEnv.CmdExe, InstallCommandline);

        // copy files to device if we were staging
        if (SC.Stage)
        {
            // cache some strings
            string BaseCommandline = AdbCommand + "push";
            string RemoteDir = "/mnt/sdcard/" + Params.ShortProjectName;
            string UE4GameRemoteDir = "/mnt/sdcard/" + Params.ShortProjectName;

            // make sure device is at a clean state
            Run(CmdEnv.CmdExe, AdbCommand + "shell rm -rf " + RemoteDir);
            Run(CmdEnv.CmdExe, AdbCommand + "shell rm -rf " + UE4GameRemoteDir);

            string[] Files = Directory.GetFiles(SC.StageDirectory, "*", SearchOption.AllDirectories);
            // copy each UFS file
            foreach (string Filename in Files)
            {
                // don't push the apk, we install it
                if (Path.GetExtension(Filename).Equals(".apk", StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                string FinalRemoteDir = RemoteDir;
                // handle the special case of the UE4Commandline.txt when using content only game (UE4Game)
                if (!Params.IsCodeBasedProject &&
                    Path.GetFileName(Filename).Equals("UE4CommandLine.txt", StringComparison.InvariantCultureIgnoreCase))
                {
                    FinalRemoteDir = "/mnt/sdcard/UE4Game";
                }

                string RemoteFilename = Filename.Replace(SC.StageDirectory, FinalRemoteDir).Replace("\\", "/");
         				string Commandline = string.Format("{0} \"{1}\" \"{2}\"", BaseCommandline, Filename, RemoteFilename);
         				Run(CmdEnv.CmdExe, Commandline);
            }

            // delete the .obb file, since it will cause nothing we just deployed to be used
            Run(CmdEnv.CmdExe, AdbCommand + "shell rm -f " + DeviceObbName);
        }
    }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:53,代码来源:AndroidPlatform.Automation.cs


示例19: CreateArchiveManifest

    public static void CreateArchiveManifest(ProjectParams Params, DeploymentContext SC)
    {
        if (!Params.Archive)
        {
            return;
        }
        var ThisPlatform = SC.StageTargetPlatform;

        ThisPlatform.GetFilesToArchive(Params, SC);

        //@todo add any archive meta data files as needed
    }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:12,代码来源:ArchiveCommand.Automation.cs


示例20: Deploy

        public override void Deploy(DeploymentContext context)
        {
            if (!EnvironmentIsValidForPackage(context))
            {
                return;
            }

            // services are installed in a '\services' subfolder
            context.TargetInstallationFolder = Path.Combine(_serviceInstallationPath, context.Package.Id);

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DeploymentResult类代码示例发布时间:2022-05-24
下一篇:
C# Deployment类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap