本文整理汇总了C#中Microsoft.Build.Utilities.TaskLoggingHelper类的典型用法代码示例。如果您正苦于以下问题:C# TaskLoggingHelper类的具体用法?C# TaskLoggingHelper怎么用?C# TaskLoggingHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskLoggingHelper类属于Microsoft.Build.Utilities命名空间,在下文中一共展示了TaskLoggingHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPaths
public static void GetPaths (out string monoDroidBinDir, out string monoDroidFrameworkDir,
out string androidSdkPath, out string javaSdkPath, TaskLoggingHelper log)
{
monoDroidBinDir = monoDroidFrameworkDir = androidSdkPath = javaSdkPath = null;
GetMonoDroidSdk (out monoDroidBinDir, out monoDroidFrameworkDir);
GetConfiguredSdkLocations (out androidSdkPath, out javaSdkPath, log);
if (!ValidateAndroidSdkLocation (androidSdkPath))
androidSdkPath = null;
if (!ValidateJavaSdkLocation (javaSdkPath))
javaSdkPath = null;
if (androidSdkPath != null && javaSdkPath != null)
return;
var path = Environment.GetEnvironmentVariable ("PATH");
var pathDirs = path.Split (new char[] { Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries);
if (androidSdkPath == null)
androidSdkPath = FindAndroidSdk (pathDirs);
if (javaSdkPath == null)
javaSdkPath = FindJavaSdk (pathDirs);
}
示例2: MsBuildTaskLogger
public MsBuildTaskLogger(TaskLoggingHelper log)
{
if (log == null)
throw new ArgumentNullException("log");
_log = log;
}
示例3: CheckFilePath
/// <summary>
/// Checks that the file path is sanitized and follows
/// all the conventions estabilished by the operating system.
/// </summary>
/// <param name="fileName">The input file name to validate.</param>
/// <param name="log">The current log instance.</param>
/// <returns>A value indicating whether the action was executed succesfuly.</returns>
internal static bool CheckFilePath(string fileName, TaskLoggingHelper log)
{
bool flag = true;
string directoryName = string.Empty;
try
{
directoryName = Path.GetDirectoryName(fileName);
}
catch (ArgumentException exception)
{
directoryName = exception.Message;
flag = false;
}
catch (PathTooLongException exception2)
{
directoryName = exception2.Message;
flag = false;
}
if (!flag)
{
log.LogErrorFromResources("InvalidPathChars", new object[] { directoryName });
}
return flag;
}
示例4: SerializeCache
internal virtual void SerializeCache(string stateFile, TaskLoggingHelper log)
{
try
{
if ((stateFile != null) && (stateFile.Length > 0))
{
if (File.Exists(stateFile))
{
File.Delete(stateFile);
}
using (FileStream stream = new FileStream(stateFile, FileMode.CreateNew))
{
new BinaryFormatter().Serialize(stream, this);
}
}
}
catch (Exception exception)
{
if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception))
{
throw;
}
log.LogWarningWithCodeFromResources("General.CouldNotWriteStateFile", new object[] { stateFile, exception.Message });
}
}
示例5: ReferenceTable
internal ReferenceTable(bool findDependencies, bool findSatellites, bool findSerializationAssemblies, bool findRelatedFiles, string[] searchPaths, string[] allowedAssemblyExtensions, string[] relatedFileExtensions, string[] candidateAssemblyFiles, string[] frameworkPaths, InstalledAssemblies installedAssemblies, System.Reflection.ProcessorArchitecture targetProcessorArchitecture, Microsoft.Build.Shared.FileExists fileExists, Microsoft.Build.Shared.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, OpenBaseKey openBaseKey, GetAssemblyRuntimeVersion getRuntimeVersion, Version targetedRuntimeVersion, Version projectTargetFramework, FrameworkName targetFrameworkMoniker, TaskLoggingHelper log, string[] latestTargetFrameworkDirectories, bool copyLocalDependenciesWhenParentReferenceInGac, CheckIfAssemblyInGac checkIfAssemblyIsInGac)
{
this.log = log;
this.findDependencies = findDependencies;
this.findSatellites = findSatellites;
this.findSerializationAssemblies = findSerializationAssemblies;
this.findRelatedFiles = findRelatedFiles;
this.frameworkPaths = frameworkPaths;
this.allowedAssemblyExtensions = allowedAssemblyExtensions;
this.relatedFileExtensions = relatedFileExtensions;
this.installedAssemblies = installedAssemblies;
this.targetProcessorArchitecture = targetProcessorArchitecture;
this.fileExists = fileExists;
this.directoryExists = directoryExists;
this.getDirectories = getDirectories;
this.getAssemblyName = getAssemblyName;
this.getAssemblyMetadata = getAssemblyMetadata;
this.getRuntimeVersion = getRuntimeVersion;
this.projectTargetFramework = projectTargetFramework;
this.targetedRuntimeVersion = targetedRuntimeVersion;
this.openBaseKey = openBaseKey;
this.targetFrameworkMoniker = targetFrameworkMoniker;
this.latestTargetFrameworkDirectories = latestTargetFrameworkDirectories;
this.copyLocalDependenciesWhenParentReferenceInGac = copyLocalDependenciesWhenParentReferenceInGac;
this.checkIfAssemblyIsInGac = checkIfAssemblyIsInGac;
this.compiledSearchPaths = AssemblyResolution.CompileSearchPaths(searchPaths, candidateAssemblyFiles, targetProcessorArchitecture, frameworkPaths, fileExists, getAssemblyName, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, openBaseKey, installedAssemblies, getRuntimeVersion, targetedRuntimeVersion);
}
示例6: ConnectionContext
public ConnectionContext(NetworkStream clientStream, string connString, TcpTestServer3 server, TaskLoggingHelper log)
{
this.clientStream = clientStream;
this.connString = connString;
this.tcpServer = server;
this.log = log;
}
示例7: DataDrivenToolTask
/// <summary>
/// Default constructor
/// </summary>
protected DataDrivenToolTask(ResourceManager taskResources)
: base(taskResources)
{
logPrivate = new TaskLoggingHelper(this);
logPrivate.TaskResources = AssemblyResources.PrimaryResources;
logPrivate.HelpKeywordPrefix = "MSBuild.";
}
示例8: Task
protected Task(ResourceManager taskResources,
string helpKeywordPrefix)
{
log = new TaskLoggingHelper (this);
log.TaskResources = taskResources;
this.helpKeywordPrefix = helpKeywordPrefix;
}
示例9: TaskLogger
public TaskLogger(TaskLoggingHelper taskLoggingHelper)
{
if (taskLoggingHelper == null)
throw new ArgumentNullException("taskLoggingHelper");
this.taskLoggingHelper = taskLoggingHelper;
}
示例10: ComReference
/// <summary>
/// Internal constructor
/// </summary>
/// <param name="taskLoggingHelper">task logger instance used for logging</param>
/// <param name="silent">true if this task should log only errors, no warnings or messages; false otherwise</param>
/// <param name="referenceInfo">cached reference information (typelib pointer, original task item, typelib name etc.)</param>
/// <param name="itemName">reference name (for better logging experience)</param>
internal ComReference(TaskLoggingHelper taskLoggingHelper, bool silent, ComReferenceInfo referenceInfo, string itemName)
{
_referenceInfo = referenceInfo;
_itemName = itemName;
_log = taskLoggingHelper;
_silent = silent;
}
示例11: 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;
}
示例12: DeserializeCache
internal static StateFileBase DeserializeCache(string stateFile, TaskLoggingHelper log, Type requiredReturnType)
{
StateFileBase o = null;
try
{
if (((stateFile == null) || (stateFile.Length <= 0)) || !File.Exists(stateFile))
{
return o;
}
using (FileStream stream = new FileStream(stateFile, FileMode.Open))
{
object obj2 = new BinaryFormatter().Deserialize(stream);
o = obj2 as StateFileBase;
if ((o == null) && (obj2 != null))
{
log.LogMessageFromResources("General.CouldNotReadStateFileMessage", new object[] { stateFile, log.FormatResourceString("General.IncompatibleStateFileType", new object[0]) });
}
if ((o != null) && !requiredReturnType.IsInstanceOfType(o))
{
log.LogWarningWithCodeFromResources("General.CouldNotReadStateFile", new object[] { stateFile, log.FormatResourceString("General.IncompatibleStateFileType", new object[0]) });
o = null;
}
}
}
catch (Exception exception)
{
log.LogWarningWithCodeFromResources("General.CouldNotReadStateFile", new object[] { stateFile, exception.Message });
}
return o;
}
示例13: GetTable
internal static bool GetTable(TaskLoggingHelper log, string parameterName, string[] propertyList, out Hashtable propertiesTable)
{
propertiesTable = null;
if (propertyList != null)
{
propertiesTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
foreach (string str in propertyList)
{
string str2 = string.Empty;
string str3 = string.Empty;
int index = str.IndexOf('=');
if (index != -1)
{
str2 = str.Substring(0, index).Trim();
str3 = str.Substring(index + 1).Trim();
}
if (str2.Length == 0)
{
if (log != null)
{
log.LogErrorWithCodeFromResources("General.InvalidPropertyError", new object[] { parameterName, str });
}
return false;
}
propertiesTable[str2] = str3;
}
}
return true;
}
示例14: CompilerErrorSink
/// <summary>
/// Constructor for the error sink
/// </summary>
/// <param name="logger">This parameter should be the logger for the task being executed</param>
public CompilerErrorSink(TaskLoggingHelper/*!*/ logger)
{
if (logger == null)
throw new ArgumentNullException("logger");
this.logger = logger;
}
示例15: SerializeCache
/// <summary>
/// Writes the contents of this object out to the specified file.
/// </summary>
/// <param name="stateFile"></param>
virtual internal void SerializeCache(string stateFile, TaskLoggingHelper log)
{
try
{
if (!string.IsNullOrEmpty(stateFile))
{
if (File.Exists(stateFile))
{
File.Delete(stateFile);
}
using (FileStream s = new FileStream(stateFile, FileMode.CreateNew))
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(s, this);
}
}
}
catch (Exception e)
{
// If there was a problem writing the file (like it's read-only or locked on disk, for
// example), then eat the exception and log a warning. Otherwise, rethrow.
if (ExceptionHandling.NotExpectedSerializationException(e))
throw;
// Not being able to serialize the cache is not an error, but we let the user know anyway.
// Don't want to hold up processing just because we couldn't read the file.
log.LogWarningWithCodeFromResources("General.CouldNotWriteStateFile", stateFile, e.Message);
}
}