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


C# ITaskItem类代码示例

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


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

示例1: AppendSwitchIfNotNull

 internal void AppendSwitchIfNotNull(string switchName, ITaskItem[] parameters, string[] metadataNames, bool[] treatAsFlags)
 {
     Microsoft.Build.Shared.ErrorUtilities.VerifyThrow((treatAsFlags == null) || (metadataNames.Length == treatAsFlags.Length), "metadataNames and treatAsFlags should have the same length.");
     if (parameters != null)
     {
         foreach (ITaskItem item in parameters)
         {
             base.AppendSwitchIfNotNull(switchName, item.ItemSpec);
             if (metadataNames != null)
             {
                 for (int i = 0; i < metadataNames.Length; i++)
                 {
                     string metadata = item.GetMetadata(metadataNames[i]);
                     if ((metadata != null) && (metadata.Length > 0))
                     {
                         if ((treatAsFlags == null) || !treatAsFlags[i])
                         {
                             base.CommandLine.Append(',');
                             base.AppendTextWithQuoting(metadata);
                         }
                         else if (MetadataConversionUtilities.TryConvertItemMetadataToBool(item, metadataNames[i]))
                         {
                             base.CommandLine.Append(',');
                             base.AppendTextWithQuoting(metadataNames[i]);
                         }
                     }
                     else if ((treatAsFlags == null) || !treatAsFlags[i])
                     {
                         break;
                     }
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:CommandLineBuilderExtension.cs

示例2: GetTarget

 static string GetTarget(ITaskItem x)
 {
     var target = x.GetMetadata("TargetPath");
     if (Path.GetFileName(x.ItemSpec) == Path.GetFileName(target))
         target = Path.GetDirectoryName(target);
     return target;
 }
开发者ID:modulexcite,项目名称:openwrap,代码行数:7,代码来源:PublishPackageContent.cs

示例3: RemoveDirectory

 private bool RemoveDirectory(ITaskItem directory, bool logUnauthorizedError, out bool unauthorizedAccess)
 {
     bool flag = true;
     unauthorizedAccess = false;
     try
     {
         Directory.Delete(directory.ItemSpec, true);
     }
     catch (UnauthorizedAccessException exception)
     {
         flag = false;
         if (logUnauthorizedError)
         {
             base.Log.LogErrorWithCodeFromResources("RemoveDir.Error", new object[] { directory, exception.Message });
         }
         unauthorizedAccess = true;
     }
     catch (Exception exception2)
     {
         if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception2))
         {
             throw;
         }
         base.Log.LogErrorWithCodeFromResources("RemoveDir.Error", new object[] { directory.ItemSpec, exception2.Message });
         flag = false;
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:RemoveDir.cs

示例4: ConvertPackageElement

        protected ITaskItem ConvertPackageElement(ITaskItem project, PackageReference packageReference)
        {
            var id = packageReference.Id;
            var version = packageReference.Version;
            var targetFramework = packageReference.TargetFramework;
            var isDevelopmentDependency = packageReference.IsDevelopmentDependency;
            var requireReinstallation = packageReference.RequireReinstallation;
            var versionConstraint = packageReference.VersionConstraint;

            var item = new TaskItem(id);
            project.CopyMetadataTo(item);

            var packageDirectoryPath = GetPackageDirectoryPath(project.GetMetadata("FullPath"), id, version);
            item.SetMetadata("PackageDirectoryPath", packageDirectoryPath);
            item.SetMetadata("ProjectPath", project.GetMetadata("FullPath"));

            item.SetMetadata("IsDevelopmentDependency", isDevelopmentDependency.ToString());
            item.SetMetadata("RequireReinstallation", requireReinstallation.ToString());

            if (version != null)
                item.SetMetadata(Metadata.Version, version.ToString());

            if (targetFramework != null)
                item.SetMetadata(Metadata.TargetFramework, targetFramework.GetShortFrameworkName());

            if (versionConstraint != null)
                item.SetMetadata("VersionConstraint", versionConstraint.ToString());

            return item;
        }
开发者ID:NN---,项目名称:nuproj,代码行数:30,代码来源:ReadPackagesConfig.cs

示例5: ComputeNeutralXlfName

        private string ComputeNeutralXlfName(ITaskItem neutralResouce)
        {
            var filename = neutralResouce.GetMetadata("Filename");
            var xlfRootPath = LocalizationUtils.ComputeXlfRootPath(neutralResouce);

            return Path.Combine(xlfRootPath, filename + ".xlf");
        }
开发者ID:cdmihai,项目名称:msbuild,代码行数:7,代码来源:ConvertToNeutralXlf.cs

示例6: CheckIfSourceNeedsCompilation

 private void CheckIfSourceNeedsCompilation(ConcurrentQueue<ITaskItem> sourcesNeedingCompilationList, bool allOutputFilesExist, ITaskItem source)
 {
     if (!this.tlogAvailable || (this.outputFileGroup == null))
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiledAsNoTrackingLog");
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.useMinimalRebuildOptimization && !allOutputFilesExist)
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceOutputsNotAvailable");
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.IsUpToDate(source))
     {
         if (string.IsNullOrEmpty(source.GetMetadata("_trackerCompileReason")))
         {
             source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiled");
         }
         sourcesNeedingCompilationList.Enqueue(source);
     }
     else if (!this.useMinimalRebuildOptimization && (this.outputNewestTime == DateTime.MinValue))
     {
         source.SetMetadata("_trackerCompileReason", "Tracking_SourceNotInTrackingLog");
         sourcesNeedingCompilationList.Enqueue(source);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:CanonicalTrackedInputFiles.cs

示例7: AppendFileNamesIfNotNull

 public void AppendFileNamesIfNotNull(ITaskItem[] fileItems, string delimiter)
 {
     ErrorUtilities.VerifyThrowArgumentNull(delimiter, "delimiter");
     if ((fileItems != null) && (fileItems.Length > 0))
     {
         for (int i = 0; i < fileItems.Length; i++)
         {
             if (fileItems[i] != null)
             {
                 this.VerifyThrowNoEmbeddedDoubleQuotes(string.Empty, fileItems[i].ItemSpec);
             }
         }
         this.AppendSpaceIfNotEmpty();
         for (int j = 0; j < fileItems.Length; j++)
         {
             if (j != 0)
             {
                 this.AppendTextUnquoted(delimiter);
             }
             if (fileItems[j] != null)
             {
                 this.AppendFileNameWithQuoting(fileItems[j].ItemSpec);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:CommandLineBuilder.cs

示例8: CopyMetadataTo

 public static void CopyMetadataTo(this ITaskItem source, ITaskItem destination, string prefix)
 {
     foreach (string key in source.CloneCustomMetadata().Keys.OfType<string>())
     {
         destination.SetMetadata(String.Concat(prefix, key), source.GetMetadata(key));
     }
 }
开发者ID:automatonic,项目名称:exult,代码行数:7,代码来源:TaskItemExtensions.cs

示例9: RegFree

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="RegFree"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public RegFree()
		{
			Dlls = new ITaskItem[0];
			Fragments = new ITaskItem[0];
			AsIs = new ITaskItem[0];
			NoTypeLib = new ITaskItem[0];
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:RegFree.cs

示例10: Execute

		public override bool Execute() {
			var inputsGroupedByConfigFile = new Dictionary<string, List<WorkItem>>();
		
			OutputFiles = new ITaskItem[InputFiles.Length];
			for (int i = 0; i < InputFiles.Length; i++) {
				string infileLocal = InputFiles[i].ItemSpec;
				OutputFiles[i] = new TaskItem(Path.ChangeExtension(infileLocal, ExecutablesCommon.GeneratedFileExtension));
				string infile     = Path.GetFullPath(infileLocal);
				string outfile    = Path.ChangeExtension(infile, ExecutablesCommon.GeneratedFileExtension);
				string configFile = ExecutablesCommon.FindConfigFilePath(infile) ?? "";
				List<WorkItem> l;
				if (!inputsGroupedByConfigFile.TryGetValue(configFile, out l))
					inputsGroupedByConfigFile[configFile] = l = new List<WorkItem>();
				l.Add(new WorkItem() { InFile = infile, OutFile = outfile, Namespace = FindNamespace(InputFiles[i]) });
			}

			bool success = true;
			foreach (var kvp in inputsGroupedByConfigFile) {
                ExecutablesCommon.ProcessWorkItemsInSeparateAppDomain(kvp.Key, kvp.Value, (item, ex) => {
                    if (ex is TemplateErrorException) {
						Log.LogError(null, null, null, item.InFile, 0, 0, 0, 0, ex.Message);
						success = false;
					}
					else {
						Log.LogErrorFromException(ex, true, true, item.InFile);
						success = false;
					}
                    return true;
                });
			}
			return success;
		}
开发者ID:fiinix00,项目名称:Saltarelle,代码行数:32,代码来源:SalgenTask.cs

示例11: BuildProjectSystem

 public BuildProjectSystem(string root, FrameworkName targetFramework, ITaskItem[] currentReferences)
     : base(root)
 {
     _targetFramework = targetFramework;
     _currentReferences = currentReferences;
     OutputReferences = new List<string>();
 }
开发者ID:anurse,项目名称:NuGetBuild,代码行数:7,代码来源:BuildProjectSystem.cs

示例12: ExpandWildcards

 private static ITaskItem[] ExpandWildcards(ITaskItem[] expand)
 {
     if (expand == null)
     {
         return null;
     }
     ArrayList list = new ArrayList();
     foreach (ITaskItem item in expand)
     {
         if (Microsoft.Build.Shared.FileMatcher.HasWildcards(item.ItemSpec))
         {
             foreach (string str in Microsoft.Build.Shared.FileMatcher.GetFiles(null, item.ItemSpec))
             {
                 TaskItem item2 = new TaskItem(item) {
                     ItemSpec = str
                 };
                 Microsoft.Build.Shared.FileMatcher.Result result = Microsoft.Build.Shared.FileMatcher.FileMatch(item.ItemSpec, str);
                 if ((result.isLegalFileSpec && result.isMatch) && ((result.wildcardDirectoryPart != null) && (result.wildcardDirectoryPart.Length > 0)))
                 {
                     item2.SetMetadata("RecursiveDir", result.wildcardDirectoryPart);
                 }
                 list.Add(item2);
             }
         }
         else
         {
             list.Add(item);
         }
     }
     return (ITaskItem[]) list.ToArray(typeof(ITaskItem));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:CreateItem.cs

示例13: ValidationPattern

            public ValidationPattern(ITaskItem item, TaskLoggingHelper log)
            {
                string idRegex = item.GetMetadata("IdentityRegex");
                if (string.IsNullOrEmpty(idRegex))
                {
                    // Temporarily support reading the regex from the Include/ItemSpec for backwards compatibility
                    // when the IdentityRegex isn't specified. This can be removed once all consumers are using IdentityRegex.
                    idRegex = item.ItemSpec;
                }

                _idPattern = new Regex(idRegex);
                _expectedVersion = item.GetMetadata("ExpectedVersion");
                _expectedPrerelease = item.GetMetadata("ExpectedPrerelease");
                _log = log;

                if (string.IsNullOrWhiteSpace(_expectedVersion))
                {
                    if (string.IsNullOrWhiteSpace(_expectedPrerelease))
                    {
                        _log.LogError(
                            "Can't find ExpectedVersion or ExpectedPrerelease metadata on item {0}",
                            item.ItemSpec);
                    }
                }
                else if (!string.IsNullOrWhiteSpace(_expectedPrerelease))
                {
                    _log.LogError(
                        "Both ExpectedVersion and ExpectedPrerelease metadata found on item {0}, but only one permitted",
                        item.ItemSpec);
                }
            }
开发者ID:dsgouda,项目名称:buildtools,代码行数:31,代码来源:ValidateProjectDependencyVersions.cs

示例14: GetLinkPath

		static string GetLinkPath (ITaskItem file, string path)
		{
			string link = file.GetMetadata ("Link");
			if (!string.IsNullOrEmpty (link)) {
				return link;
			}

			string projectDir;
			var definingProject = file.GetMetadata ("DefiningProjectFullPath");
			if (!string.IsNullOrEmpty (definingProject)) {
				projectDir = Path.GetDirectoryName (definingProject);
			} else {
				projectDir = Environment.CurrentDirectory;
			}

			projectDir = Path.GetFullPath (projectDir);
			if (projectDir [projectDir.Length - 1] != Path.DirectorySeparatorChar) {
				projectDir += Path.DirectorySeparatorChar;
			}

			if (path.StartsWith (projectDir, StringComparison.Ordinal)) {
				link = path.Substring (projectDir.Length);
			} else {
				link = Path.GetFileName (path);
			}

			return link;
		}
开发者ID:Therzok,项目名称:MonoDevelop.AddinMaker,代码行数:28,代码来源:CollectOutputFiles.cs

示例15: Execute

        public override bool Execute()
        {
            try {
                string authors;
                using (var fs = new FileStream (AuthorsFile.GetMetadata ("FullPath"), FileMode.Open)) {
                    using (var sr = new StreamReader (fs)) {

                        var authorsStrBuilder = new StringBuilder ();

                        while (!sr.EndOfStream) {
                            var line = sr.ReadLine ().Trim ();
                            if (!string.IsNullOrWhiteSpace (line))
                                authorsStrBuilder.Append ("\"" + line + "\", ");
                        }

                        authors = authorsStrBuilder.ToString ();
                    }
                }

                Output = new TaskItem (authors);
            } catch (Exception ex) {
                Log.LogErrorFromException (ex);
                return false;
            }
            return true;
        }
开发者ID:mono-soc-2012,项目名称:Tasque,代码行数:26,代码来源:PrepareAuthorsFile.cs


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