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


C# MockEngine.RecordRARExecutionException方法代码示例

本文整理汇总了C#中MockEngine.RecordRARExecutionException方法的典型用法代码示例。如果您正苦于以下问题:C# MockEngine.RecordRARExecutionException方法的具体用法?C# MockEngine.RecordRARExecutionException怎么用?C# MockEngine.RecordRARExecutionException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MockEngine的用法示例。


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

示例1: Resolve

        public virtual VsResolvedAssemblyPath[] Resolve(IEnumerable<string> assemblies)
        {
            if (assemblies == null)
            {
                throw new ArgumentNullException("assemblies");
            }

            // Resolve references WITHOUT invoking MSBuild to avoid re-entrancy problems.
            const bool projectDtar = true;
            var rar = new Microsoft.Build.Tasks.ResolveAssemblyReference();
            var engine = new MockEngine(EnableLogging);
            rar.BuildEngine = engine;

            // first set common properties/items then if projectDtar then set additional projectDtar properties
            ITaskItem[] assemblyItems = assemblies.Select(assembly => new TaskItem(assembly)).ToArray();
            rar.Assemblies = assemblyItems;
            rar.SearchPaths = rarInputs.PdtarSearchPaths;

            rar.TargetFrameworkDirectories = rarInputs.TargetFrameworkDirectories;
            rar.AllowedAssemblyExtensions = rarInputs.AllowedAssemblyExtensions;
            rar.TargetProcessorArchitecture = rarInputs.TargetProcessorArchitecture;
            rar.TargetFrameworkVersion = rarInputs.TargetFrameworkVersion;
            rar.TargetFrameworkMoniker = rarInputs.TargetFrameworkMoniker;
            rar.TargetFrameworkMonikerDisplayName = rarInputs.TargetFrameworkMonikerDisplayName;
            rar.TargetedRuntimeVersion = rarInputs.TargetedRuntimeVersion;
            rar.FullFrameworkFolders = rarInputs.FullFrameworkFolders;
            rar.LatestTargetFrameworkDirectories = rarInputs.LatestTargetFrameworkDirectories;
            rar.FullTargetFrameworkSubsetNames = rarInputs.FullTargetFrameworkSubsetNames;
            rar.FullFrameworkAssemblyTables = rarInputs.FullFrameworkAssemblyTables;
            rar.IgnoreDefaultInstalledAssemblySubsetTables = rarInputs.IgnoreDefaultInstalledAssemblySubsetTables;
            rar.ProfileName = rarInputs.ProfileName;

            rar.Silent = !this.EnableLogging;
            rar.FindDependencies = true;
            rar.AutoUnify = false;
            rar.FindSatellites = false;
            rar.FindSerializationAssemblies = false;
            rar.FindRelatedFiles = false;

            // This set needs to be kept in sync with the set of project instance data that
            // is populated into RarInputs
            if (projectDtar)
            {
                // set project dtar specific properties
                rar.CandidateAssemblyFiles = rarInputs.CandidateAssemblyFiles;
                rar.StateFile = rarInputs.StateFile;
                rar.InstalledAssemblySubsetTables = rarInputs.InstalledAssemblySubsetTables;
                rar.TargetFrameworkSubsets = rarInputs.TargetFrameworkSubsets;
            }

            IEnumerable<VsResolvedAssemblyPath> results;

            try
            {
                rar.Execute();
                results = FilterResults(rar.ResolvedFiles).Select(pair => new VsResolvedAssemblyPath
                {
                    bstrOrigAssemblySpec = pair.Key,
                    bstrResolvedAssemblyPath = pair.Value,
                });
            }
            catch (Exception ex)
            {
                if (ErrorHandler.IsCriticalException(ex))
                {
                    throw;
                }

                engine.RecordRARExecutionException(ex);
                results = Enumerable.Empty<VsResolvedAssemblyPath>();
            }
            finally
            {
                if (this.EnableLogging)
                {
                    WriteLogFile(engine, projectDtar, assemblies);
                }
            }

            return results.ToArray();
        }
开发者ID:Graham-Pedersen,项目名称:IronPlot,代码行数:81,代码来源:DesignTimeAssemblyResolution.cs


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