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

C# ITaskItem类代码示例

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

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



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

        public string Parse(ITaskItem taskItem, bool fullOutputName, string outputExtension)
        {
            CommandLineBuilder builder = new CommandLineBuilder();

            foreach (string name in taskItem.MetadataNames)
            {
                string value = taskItem.GetMetadata(name);
                if (outputExtension != null && name == "OutputFile")
                {
                    value = Path.ChangeExtension(value, outputExtension);
                }
                if (fullOutputName && name == "ObjectFileName")
                {
                    if ((File.GetAttributes(value) & FileAttributes.Directory) != 0)
                    {
                        value = Path.Combine(value, Path.GetFileName(taskItem.ItemSpec));
                        value = Path.ChangeExtension(value, ".obj");
                    }
                }
                AppendArgumentForProperty(builder, name, value);
            }

            string result = builder.ToString();
            result = result.Replace('\\', '/'); // posix paths
            return result;
        }
开发者ID:udiavr,项目名称:nativeclient-sdk,代码行数:26,代码来源:XamlParser.cs


示例16: FlattenFilePaths

		internal string FlattenFilePaths(ITaskItem[] items, char delimeter, bool withQuotes)
		{
			var sb = new StringBuilder();
			bool haveStarted = false;
			foreach (var item in items)
			{
				if (haveStarted)
				{
					sb.Append(delimeter);
				}
				string filePath = TrimBaseFromFilePath(item.ItemSpec);
				if (filePath.Contains(" ") || withQuotes)
				{
					sb.Append('"');
					sb.Append(filePath);
					sb.Append('"');
				}
				else
				{
					sb.Append(filePath);
				}
				haveStarted = true;
			}
			return sb.ToString();
		}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:25,代码来源:Archive.cs


示例17: ResolvePackage

        private IEnumerable<ITaskItem> ResolvePackage(ITaskItem package)
        {
            string id = package.ItemSpec;
            string version = package.GetMetadata("Version");

            Log.LogMessage(MessageImportance.Normal, "Resolving Package Reference {0} {1}...", id, version);

            // Initial version just searches a machine-level repository

            var localFs = new PhysicalFileSystem(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Lib"));
            var defaultResolver = new DefaultPackagePathResolver(localFs);
            var machineRepo = new LocalPackageRepository(defaultResolver, localFs);
            var buildRepo = new BuildPackageRepository();
            var remoteRepo = new DataServicePackageRepository(new Uri("https://nuget.org/api/v2"));
            var project = new BuildProjectSystem(ProjectDirectory, new FrameworkName(TargetFramework), CurrentReferences);
            var manager = new PackageManager(remoteRepo, defaultResolver, localFs, machineRepo);
            var projectManager = new ProjectManager(remoteRepo, defaultResolver, project, buildRepo);

            // Install the package
            var ver = new SemanticVersion(version);
            manager.PackageInstalling += manager_PackageInstalling;
            manager.InstallPackage(id, ver);
            projectManager.AddPackageReference(id, ver);

            return project.OutputReferences.Select(item =>
            {
                var name = AssemblyName.GetAssemblyName(item);
                return new TaskItem(name.FullName, new Dictionary<string, string>() {
                    {"HintPath", item },
                    {"Private", "true"}
                });
            });
        }
开发者ID:anurse,项目名称:NuGetBuild,代码行数:33,代码来源:ResolvePackageReference.cs


示例18: ProcessFile

        private bool ProcessFile(ITaskItem item)
        {
            var result = true;
            LogItemInformation(item);

            try
            {
                var itemPath = GetItemPath(item);
                var resultPath = GetItemOutputPath(itemPath);

                if (OutputExists(itemPath, resultPath))
                {
                    Log.LogMessage("Exists: {0} -> {1}", itemPath, resultPath);
                    return true;
                }

                Log.LogMessage("Compiling: {0} -> {1}", itemPath, resultPath);

                result = DoCompile(itemPath, resultPath);
            }
            catch (Exception ex)
            {
                result = false;
                Log.LogError(ex.ToString());
                //Log.LogErrorFromException(ex);
            }

            return result;
        }
开发者ID:modulexcite,项目名称:rasterizr,代码行数:29,代码来源:CompileShader.cs


示例19: GenerateCommandLineFromProps

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    protected override string GenerateCommandLineFromProps (ITaskItem source)
    {
      // 
      // Build a command-line based on parsing switches from the registered property sheet, and any additional flags.
      // 

      try
      {
        if (source == null)
        {
          throw new ArgumentNullException ();
        }

        StringBuilder builder = new StringBuilder (PathUtils.CommandLineLength);

        builder.Append (m_parsedProperties.Parse (source));

        builder.Append (" -c "); // compile the C/C++ file

        return builder.ToString ();
      }
      catch (Exception e)
      {
        Log.LogErrorFromException (e, true);
      }

      return string.Empty;
    }
开发者ID:ashumeow,项目名称:android-plus-plus,代码行数:32,代码来源:NativeCompile.cs


示例20: Setup

		public void Setup()
		{
			ccu = new CodeCompileUnit();
			mocks = new MockRepository();
			engine = Engine.GlobalEngine;
			engine.BinPath = @"C:\Program Files (x86)\MSBuild";
			project = new Project();
			buildEngine = mocks.DynamicMock<MockBuildEngine>(project);

			logger = new NullLogger();
			parserService = mocks.DynamicMock<ISiteTreeGeneratorService>();
			naming = mocks.DynamicMock<INamingService>();
			sourceStorage = mocks.DynamicMock<IParsedSourceStorageService>();
			source = mocks.DynamicMock<ISourceGenerator>();
			typeResolver = mocks.DynamicMock<ITypeResolver>();
			treeService = mocks.DynamicMock<ITreeCreationService>();
			viewSourceMapper = mocks.DynamicMock<IViewSourceMapper>();
			generator = mocks.DynamicMock<IGenerator>();

			task = new GenerateMonoRailSiteTreeTask(logger, parserService, naming, source, sourceStorage, typeResolver,
			                                         treeService, viewSourceMapper, generator);

			item = mocks.DynamicMock<ITaskItem>();
			parsedSource = mocks.DynamicMock<IParser>();
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:25,代码来源:GenerateMonoRailSiteTreeTaskTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ITaskManager类代码示例发布时间:2022-05-24
下一篇:
C# ITask类代码示例发布时间: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