本文整理汇总了C#中Microsoft.Build.Utilities.TaskLoggingHelper.LogMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TaskLoggingHelper.LogMessage方法的具体用法?C# TaskLoggingHelper.LogMessage怎么用?C# TaskLoggingHelper.LogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Utilities.TaskLoggingHelper
的用法示例。
在下文中一共展示了TaskLoggingHelper.LogMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run(string site, TaskLoggingHelper log, int maxPages, bool strict)
{
this.MaxPages = maxPages;
this.Strict = strict;
this.log = log;
log.LogMessage("Starting site at " + site);
using (var iis = new IisConfiguration(site, log))
{
var tokill = iis.StartWebsites();
foreach (var process in tokill)
PipeProcessToLog(process);
// Create a URI class
var startUrl = new Uri("http://localhost:" + iis.Port);
log.LogMessage("##teamcity[testSuiteStarted name='SiteVerification']");
var report = RunAnalysis(startUrl);
// Run a few queries...
LogSeoViolations(report);
LogBrokenLinks(report);
LogResponseTimes(report);
log.LogMessage("##teamcity[testSuiteFinished name='SiteVerification']");
foreach (var process in tokill)
{
SendStopMessageToProcess(process.Id);
}
}
}
示例2: GetAppBuildOrder
public IEnumerable<string> GetAppBuildOrder(string sourceDirectory, string startAppPath, string uniqueSourceDirectoryPath, TaskLoggingHelper log)
{
_log = log;
_uniqueSourceDirectoryPath = uniqueSourceDirectoryPath;
var sourceDirectoryPath = sourceDirectory.Trim('\'', '"');
var appList = GetAppListWithReferences(sourceDirectoryPath);
var appPath = startAppPath.Trim('\'', '"');
var startApps = appPath.Split('|').ToList();
foreach (var app in startApps)
{
if (!string.IsNullOrEmpty(app))
{
_log.LogMessage("Application path: {0}", app);
var startApp = appList[Path.GetFullPath(app.ToUpper().Replace(sourceDirectoryPath.ToUpper(), _uniqueSourceDirectoryPath)).ToUpper()];
if (startApp == null)
{
log.LogError("Application {0} could not be found.", app);
}
else
{
_orderedAppList.Add(Path.GetFullPath(app.ToUpper().Replace(sourceDirectoryPath.ToUpper(), _uniqueSourceDirectoryPath)).ToUpper());
LoopReferences(startApp, appList);
}
}
}
_orderedAppList.ForEach(a => _log.LogMessage(a));
return _orderedAppList;
}
示例3: RemoveSelectors
public static bool RemoveSelectors(TaskLoggingHelper log, HtmlDocument document, IEnumerable<SelectorInfo> selectors)
{
bool updatedItem = false;
HtmlNodeCollection collection = document.DocumentNode.SelectNodes("//style");
int nodeNumber = 0;
foreach (HtmlNode node in collection)
{
log.LogMessage(MessageImportance.Normal, "Processing <style/> tag #{0}", nodeNumber++);
List<SelectorInfo> foundSelectors = selectors.Where(item => item.Expression.IsMatch(node.InnerText)).ToList();
foreach (SelectorInfo foundSelector in foundSelectors)
{
log.LogMessage(MessageImportance.Normal, "Found '{0}' selector. Removing all occurrences.", foundSelector.Name);
node.InnerHtml = foundSelector.Expression.Replace(node.InnerHtml, string.Empty);
updatedItem = true;
}
if (string.IsNullOrWhiteSpace(node.InnerHtml))
{
log.LogMessage(MessageImportance.Normal, "No CSS Styles remain. Removing <style/>");
node.Remove();
updatedItem = true;
}
}
return updatedItem;
}
示例4: UpdateProperties
public void UpdateProperties(string propertyOverrides, ITaskItem project, TaskLoggingHelper log)
{
log.LogMessage(MessageImportance.Normal, "Updating properties in file {0}", resourceFile.FullName);
if (string.IsNullOrWhiteSpace(propertyOverrides)) return;
var properties = propertyOverrides.ToDictionary(';', '=');
// Scan meta data for project-specific overrides
var metaDataNames = project.MetadataNames;
foreach (string metaDataName in metaDataNames)
{
properties[metaDataName] = project.GetMetadata(metaDataName);
}
var lines = File.ReadLines(resourceFile.FullName).ToList();
var results = new List<string>(lines.Count);
// Now process each line in the file)
foreach (var line in lines)
{
var key = GetKey(line);
if (key == null)
{
results.Add(line);
}
else
{
var isValueKey = false;
if (key.Equals("VALUE", StringComparison.OrdinalIgnoreCase))
{
key = GetValueKey(line);
if (string.IsNullOrEmpty(key))
{
results.Add(line);
continue;
}
isValueKey = true;
}
if (properties.ContainsKey(key))
{
log.LogMessage(MessageImportance.Low, "Setting \"{0}\" to \"{1}\"", key, properties[key]);
results.Add(string.Format(isValueKey ? "VALUE \"{0}\", \"{1}\\0\"" : "{0} {1}", key, properties[key]));
}
else
{
results.Add(line);
}
}
}
File.WriteAllLines(resourceFile.FullName, results);
}
示例5: DisplayLogo
//------------------------------------------------------
//
// Internal Helper Methods
//
//------------------------------------------------------
#region Internal Methods
// <summary>
// Output the Logo information to the logger for a given task
// (Console or registered Loggers).
// </summary>
internal static void DisplayLogo(TaskLoggingHelper log, string taskName)
{
string acPath = Assembly.GetExecutingAssembly().Location;
FileVersionInfo acFileVersionInfo = FileVersionInfo.GetVersionInfo(acPath);
string avalonFileVersion = acFileVersionInfo.FileVersion;
log.LogMessage(MessageImportance.Low,Environment.NewLine);
log.LogMessageFromResources(MessageImportance.Low, SRID.TaskLogo, taskName, avalonFileVersion);
log.LogMessageFromResources(MessageImportance.Low, SRID.TaskRight);
log.LogMessage(MessageImportance.Low, Environment.NewLine);
}
示例6: GetServiceTable
public static ServiceTable GetServiceTable(string ConnString, int ServiceTableID, TaskLoggingHelper Log)
{
ServiceTable result = new ServiceTable();
SqlConnection conn = new SqlConnection(ConnString);
conn.Open();
SqlCommand cmd = new SqlCommand("select ServiceTableID, DescServiceTable, Value, CreationDate, StringField1, StringField2 " +
"from ServiceTable where ServiceTableID = @ServiceTableID", conn);
using (conn)
{
SqlParameter p1 = cmd.Parameters.Add("@ServiceTableID", SqlDbType.Int);
p1.Value = ServiceTableID;
SqlDataReader rd = cmd.ExecuteReader();
rd.Read();
using (rd)
{
result.ServiceTableID = rd.GetInt32(0);
result.DescServiceTable = rd.GetString(1);
result.Value = (float)rd.GetDouble(2);
result.CreationDate = rd.GetDateTime(3);
result.StringField1 = rd.GetString(4);
result.StringField2 = rd.GetString(5);
}
}
if (Log != null)
Log.LogMessage("Getting ServiceTableID: " + ServiceTableID.ToString());
return result;
}
示例7: Execute
public bool Execute()
{
var rand = new Random();
int i = rand.Next(0, FamousQuotes.Count);
string quote = String.Format("{0}\r\n{1}", FamousQuotes[i].Saying, FamousQuotes[i].Author);
var loggingHelper = new TaskLoggingHelper(this);
loggingHelper.LogMessage(MessageImportance.Normal, quote);
return true;
}
示例8: RequireDirectory
public static void RequireDirectory(TaskLoggingHelper log, string directory)
{
string fullDirectory = Path.GetFullPath(directory);
if (File.Exists(fullDirectory))
throw new ArgumentException("Not a directory", "directory");
if (!Directory.Exists(fullDirectory))
{
Directory.CreateDirectory(fullDirectory);
log.LogMessage(MessageImportance.Low, "Created directory '{0}'", fullDirectory);
}
}
示例9: logEnvironmentInfo
/// <summary>
/// Log NUnit environment information.
/// </summary>
/// <param name="log">The logger.</param>
public static void logEnvironmentInfo(TaskLoggingHelper log)
{
log.LogMessage(MessageImportance.Low, "AssemblyName: {0}", AssemblyName);
log.LogMessage(MessageImportance.Low, "AssemblyCodeBase: {0}", AssemblyCodeBase);
log.LogMessage(MessageImportance.Low, "AssemblyDirectory: {0}", AssemblyDirectory);
log.LogMessage(MessageImportance.Low, "IsInteractive: {0}", IsInteractive);
log.LogMessage(MessageImportance.Low, "CalledInBuildDirectory: {0}", CalledInBuildDirectory);
log.LogMessage(MessageImportance.Low, "TestDirectory: {0}", TestDirectory);
}
示例10: ParseVersionFromCandidate
private static Version ParseVersionFromCandidate(TaskLoggingHelper logger, string pathToBaseVersionFile, string versionLineCandidate)
{
try
{
//keep it simple. no regex or other fancy ways would be overkill.
var assemblyVersion = versionLineCandidate.Split('"')[1];
logger.LogMessage(MessageImportance.Normal, "Using base version: {0}.", assemblyVersion);
Version version = new Version(assemblyVersion);
return version;
}
catch (Exception exception)
{
throw new FormatException(pathToBaseVersionFile + " Assembly version declaration is in invalid format: '" + versionLineCandidate + "'.", exception);
}
}
示例11: InstallPackages
public static bool InstallPackages(string packagesDirectory, string packagesConfigPath, string nugetExePath, TaskLoggingHelper log)
{
var nugetArguments = @"install -o " + packagesDirectory + " -Prerelease -NonInteractive " + packagesConfigPath;
log.LogMessage("Installing: " + nugetExePath + " " + nugetArguments);
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = false;
psi.FileName = nugetExePath;
psi.Arguments = nugetArguments;
psi.CreateNoWindow = true;
var process = Process.Start(psi);
if (!process.WaitForExit(20000))
{
log.LogError("Packages installation timed out.");
return false;
}
return true;
}
示例12: Extract
internal static Version Extract(TaskLoggingHelper logger, ITaskItem baseVersionItem)
{
if (baseVersionItem == null) { throw new ArgumentNullException("baseVersionItem"); }
var pathToBaseVersionFile = baseVersionItem.ItemSpec;
if (!File.Exists(pathToBaseVersionFile))
{
logger.LogMessage(MessageImportance.Low, "Working in directory: " + Environment.CurrentDirectory);
throw new InvalidOperationException("No base assembly info file exists with name " + pathToBaseVersionFile + ".");
}
// find assemblyVersion value from file: simplification, but since it is generated file, should be sufficient:
string versionLineCandidate = File.ReadAllLines(pathToBaseVersionFile)
.Where(line => !line.StartsWith("//"))
.FirstOrDefault(line => line.Contains("AssemblyVersion"));
if (versionLineCandidate == null) { throw new InvalidOperationException(pathToBaseVersionFile + " did not contain expected AssemblyVersionAttribute declaration."); }
return ParseVersionFromCandidate(logger, pathToBaseVersionFile, versionLineCandidate);
}
示例13: Initialize
public bool Initialize(string taskName, IDictionary<string, TaskPropertyInfo> parameterGroup, string taskBody, IBuildEngine taskFactoryLoggingHost)
{
TaskLoggingHelper log = new TaskLoggingHelper(taskFactoryLoggingHost, taskName);
// We use the property group for the declaration
taskProperties = (from c in parameterGroup select c.Value).ToArray();
// Compile chunk
try
{
log.LogMessage("Compile script.");
task = lua.CompileChunk(taskBody, taskName, LuaDeskop.StackTraceCompileOptions,
new KeyValuePair<string, Type>("engine", typeof(IBuildEngine)),
new KeyValuePair<string, Type>("log", typeof(TaskLoggingHelper))
);
return true;
}
catch (LuaParseException e)
{
log.LogError("{0} (at line {1},{2})", e.Message, taskName, e.Line);
return false;
}
} // func Initialize
示例14: ProcessClientBigRequest
public static void ProcessClientBigRequest(string ConnString, Stream requestStream, Stream responseStream, bool dispose, FlushDelegate flushDelegate, TaskLoggingHelper log)
{
XmlTextReader xr = new XmlTextReader(requestStream);
XmlTextWriter xw = new XmlTextWriter(responseStream, Encoding.UTF8);
xw.WriteStartDocument();
xw.WriteStartElement("table");
bool first = true;
//using (xr)
//{
xr.Read();
xr.Read();
xr.ReadStartElement("request");
while (xr.Name == "id")
{
int serviceTableID = Convert.ToInt32(xr.ReadElementString("id"));
ServiceTable st = DAO.GetServiceTable(ConnString, serviceTableID);
if (first)
{
if (log != null)
log.LogMessage("Processing ID " + serviceTableID.ToString() + " response " + st.ServiceTableID.ToString());
first = false;
}
xw.WriteStartElement("record");
xw.WriteElementString("ServiceTableID", st.ServiceTableID.ToString());
xw.WriteElementString("DescServiceTable", st.DescServiceTable);
xw.WriteElementString("Value", st.Value.ToString("0.00"));
xw.WriteElementString("CreationDate", st.CreationDate.ToString("dd/MM/yyyy hh:mm:ss"));
xw.WriteElementString("StringField1", st.StringField1);
xw.WriteElementString("StringField2", st.StringField2);
xw.WriteEndElement();
if (flushDelegate != null)
flushDelegate();
}
xr.ReadEndElement();
//}
xr.Dispose();
xw.WriteEndElement();
xw.Flush();
if (dispose)
xw.Close();
}
示例15: GetWindowsJavaSdkLocation
private static string GetWindowsJavaSdkLocation (TaskLoggingHelper log)
{
string subkey = @"SOFTWARE\JavaSoft\Java Development Kit";
log.LogMessage ("Looking for Java SDK..");
foreach (var wow64 in new[] { RegistryEx.Wow64.Key32, RegistryEx.Wow64.Key64 }) {
string key_name = string.Format (@"{0}\{1}\{2}", "HKLM", subkey, "CurrentVersion");
var currentVersion = RegistryEx.GetValueString (RegistryEx.LocalMachine, subkey, "CurrentVersion", wow64);
if (!string.IsNullOrEmpty (currentVersion)) {
log.LogMessage (" Key {0} found: {1}.", key_name, currentVersion);
if (CheckRegistryKeyForExecutable (RegistryEx.LocalMachine, subkey + "\\" + currentVersion, "JavaHome", wow64, "bin", JarSignerTool, log))
return RegistryEx.GetValueString (RegistryEx.LocalMachine, subkey + "\\" + currentVersion, "JavaHome", wow64);
}
log.LogMessage (" Key {0} not found.", key_name);
}
// We ran out of things to check..
return null;
}