本文整理汇总了C#中CodeActivityContext.TrackBuildWarning方法的典型用法代码示例。如果您正苦于以下问题:C# CodeActivityContext.TrackBuildWarning方法的具体用法?C# CodeActivityContext.TrackBuildWarning怎么用?C# CodeActivityContext.TrackBuildWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeActivityContext
的用法示例。
在下文中一共展示了CodeActivityContext.TrackBuildWarning方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the activity
/// </summary>
/// <param name="context">The activity's context</param>
protected override void Execute(CodeActivityContext context)
{
//context.Track(new CustomTrackingRecord("olalá", TraceLevel.Info));
context.TrackBuildMessage("Starting", BuildMessageImportance.High);
//context.TrackBuildError("Starting");
WorkingFolder workingFolder =
Workspace.Get(context).GetWorkingFolderForServerItem(SourcesDirectory.Get(context));
var sourcesDirectory = workingFolder.LocalItem;
context.TrackBuildWarning(string.Format("Getting js files from {0}", sourcesDirectory), BuildMessageImportance.High);
var jsFiles = Directory.GetFiles(sourcesDirectory, "*.js");
foreach (var jsFile in jsFiles)
{
context.TrackBuildWarning(string.Format("Passing tests from {0}", jsFile), BuildMessageImportance.High);
}
}
示例2: Execute
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
// Obtain the runtime value of the Text input argument
string text = context.GetValue(this.Size);
String filePath = Path.Combine(Path.GetDirectoryName(FilePath.Get(context)), "ServiceDefinition.csdef");
context.TrackBuildWarning("File Path: " + filePath, BuildMessageImportance.High);
// context.TrackBuildWarning(string.Join("\n", Directory.GetFiles(Path.GetDirectoryName(FilePath.Get(context)), "*.csdef", SearchOption.AllDirectories)), BuildMessageImportance.High);
var doc = XDocument.Load(filePath);
XNamespace ab = "http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition";
foreach(var element in doc.Root.Elements(ab + "WebRole"))
element.SetAttributeValue("vmsize", text);
foreach (var element in doc.Root.Elements(ab + "WorkerRole"))
element.SetAttributeValue("vmsize", text);
// doc.Root.Element(ab + "WebRole").SetAttributeValue("vmsize", text);
doc.Save(filePath);
}
示例3: Execute
// If your activity returns a value, derive from CodeActivity<TResult>
// and return the value from the Execute method.
protected override void Execute(CodeActivityContext context)
{
string buildFullName = context.GetExtension<IEnvironmentVariableExtension>().GetEnvironmentVariable<string>(context, WellKnownEnvironmentVariables.BuildNumber);
string buildNumber = buildFullName.Substring(buildFullName.LastIndexOf("_") + 1).Replace(".", "");
if (buildNumber.Length > 9)
{
// apprenda only allows up to 9 charachers for the version alias and it has to be alphanumeric
// in this case we are trimming the size to max 9 characters
buildNumber = buildNumber.Substring(buildNumber.Length - 9);
}
string apprendaRootURL = context.GetValue(this.ApprendaRootURL);
string cloudAlias = context.GetValue(this.CloudAlias);
string acsPath = context.GetValue(this.AcsPath);
string username = context.GetValue(this.Username);
string password = context.GetValue(this.Password);
string devTeamAlias = context.GetValue(this.DevelopmentTeamAlias);
string acsBuildParams = context.GetValue(this.AcsBuildParameters);
string[] projectToBuild = context.GetValue(this.ProjectToBuild);
string appAlias = context.GetValue(this.ApplicationAlias);
string versionNamePrefix = context.GetValue(this.VersionNamePrefix);
string packageName = projectToBuild[0].Substring(0, projectToBuild[0].LastIndexOf(".")).Substring(projectToBuild[0].LastIndexOf("/") + 1) + ".zip";
// add the Fully Qualified path including the zip extension to the name of the solution for the Apprenda package
// we will drop this ZIP file on the root folder of the build destination directory
string zipPackageFullPath = context.GetExtension<IEnvironmentVariableExtension>().GetEnvironmentVariable<string>(
context, WellKnownEnvironmentVariables.DropLocation) + @"\" + packageName;
// get the path to the solution file, after eliminating the TFS root path of $/<tfs name>/
string tfsCodeDirectory = context.GetExtension<IEnvironmentVariableExtension>().GetEnvironmentVariable<string>(
context, WellKnownEnvironmentVariables.SourcesDirectory);
string tfsRelativePath = projectToBuild[0].Substring(projectToBuild[0].IndexOf("/", 2)).Replace("/", @"\");
string tfsSolutionFilePath = tfsCodeDirectory + tfsRelativePath;
// populate the ACS path now
acsPath = (tfsCodeDirectory.EndsWith(@"\") ? tfsCodeDirectory : tfsCodeDirectory + @"\") + (acsPath.StartsWith(@"\") ? acsPath.Substring(1) : acsPath);
if (projectToBuild.Count() > 1)
{
context.TrackBuildWarning(string.Format("Apprenda: You entered more than 1 Solution in the Build Definition. The Apprenda Code Activity will only utilize the first one entered - {0}", projectToBuild[0]));
}
LogMessage("Apprenda: The Apprenda TFS Build Activity will now execute", context);
LogMessage("---Code Activity Parameters---", context);
LogMessage("ApprendaRootURL: " + apprendaRootURL, context);
LogMessage("CloudAlias: " + cloudAlias, context);
LogMessage("AcsPath: " + acsPath, context);
LogMessage("Username: " + username, context);
LogMessage("Password: ********", context);
LogMessage("DevelopmentTeamAlias: " + devTeamAlias, context);
LogMessage("AcsBuildParameters: " + acsBuildParams, context);
LogMessage("ProjectToBuild: " + projectToBuild[0], context);
LogMessage("ApplicationAlias: " + appAlias, context);
string acsRegisterCloudCmd = string.Format(RegisterCloud, acsPath, apprendaRootURL, cloudAlias);
string acsConnectCloudCmd = string.Format(ConnectCloud, acsPath, cloudAlias, username, password, devTeamAlias);
string acsNewPackageCmd = string.Format(NewPackage, acsPath, tfsSolutionFilePath, zipPackageFullPath, acsBuildParams);
string acsNewVersionCmd = string.Format(NewVersion, acsPath, appAlias, buildNumber, "Created from Apprenda TFS Activity", zipPackageFullPath, buildFullName);
string acsDisconnectCloudCmd = string.Format(DisconnectCloud, acsPath);
LogMessage("---Code Activity Constructed Commands---", context);
LogMessage("ACS command 1: " + acsRegisterCloudCmd, context);
LogMessage("ACS command 2: " + acsConnectCloudCmd.Replace(password, "********"), context);
LogMessage("ACS command 3: " + acsNewPackageCmd, context);
LogMessage("ACS command 4: " + acsNewVersionCmd, context);
LogMessage("ACS command 5: " + acsDisconnectCloudCmd, context);
var buildDetail = context.GetExtension<IBuildDetail>();
buildDetail.RefreshAllDetails();
if (!buildDetail.BuildFinished)
{
LogMessage("Apprenda: Build is not finished yet! - " + buildDetail.Status.ToString(), context);
}
LogMessage("---Execute Apprenda ACS Utility Commands---", context);
this.RunCommand(acsRegisterCloudCmd, context);
this.RunCommand(acsConnectCloudCmd, context);
this.RunCommand(acsNewPackageCmd, context);
this.RunCommand(acsNewVersionCmd, context);
this.RunCommand(acsDisconnectCloudCmd, context);
}
示例4: Execute
/// <summary>
/// Executes the activity and returns the data necessary to execute putty (executable + arguments)
/// </summary>
/// <param name="context">The context</param>
protected override void Execute(CodeActivityContext context)
{
var toolsPath = PuttyHelper.GetPuttyPath(this.ToolsPath.Get(context));
if (string.IsNullOrEmpty(toolsPath))
{
context.TrackBuildWarning("can't determine PuTTy tools path. Will rely on path");
toolsPath = string.Empty;
}
this.ToolCommandPath.Set(context, Path.Combine(toolsPath, "pscp.exe"));
this.Arguments.Set(context, this.GenerateCommandLineCommands(context));
}