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


C# IProjectContent.AddAssemblyReferences方法代码示例

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


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

示例1: CSharpCompletion

        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
            {
                    typeof(object).Assembly, // mscorlib
                    typeof(Uri).Assembly, // System.dll
                    typeof(Enumerable).Assembly, // System.Core.dll
//					typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
//					typeof(System.Drawing.Bitmap).Assembly, // System.Drawing.dll
//					typeof(Form).Assembly, // System.Windows.Forms.dll
//					typeof(ICSharpCode.NRefactory.TypeSystem.IProjectContent).Assembly,
                };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();
            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);
        }
开发者ID:uQr,项目名称:NRefactory-Completion-Sample,代码行数:28,代码来源:CSharpCompletion.cs

示例2: CSharpCompletion

        public CSharpCompletion()
        {
            projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
            {
                typeof(object).Assembly, // mscorlib
                typeof(Uri).Assembly, // System.dll
                typeof(Enumerable).Assembly, // System.Core.dll
                typeof(System.Xml.XmlDocument).Assembly, // System.Xml.dll
                typeof(Sandbox.Common.ObjectBuilders.MyObjectBuilder_AdvancedDoor).Assembly, // SpaceEngineers.ObjectBuilders.dll
                typeof(SpaceEngineers.Game.ModAPI.IMyButtonPanel).Assembly, // SpaceEngineers.Game.dll
                typeof(Sandbox.MySandboxGame).Assembly, // Sandbox.Game.dll
                typeof(Sandbox.ModAPI.MyAPIGateway).Assembly, // Sandbox.Common.dll
                typeof(Sandbox.Graphics.GUI.MyGuiSandbox).Assembly, // Sandbox.Graphics.dll
                typeof(VRage.MyModelData).Assembly, // VRage.dll
                typeof(VRage.Exceptions).Assembly, // VRage.Library.dll
                typeof(VRageMath.MathHelper).Assembly, // VRage.Math
                typeof(VRage.Game.ObjectBuilders.MyObjectBuilder_EntityStat).Assembly, //VRage.Game
            };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Stopwatch total = Stopwatch.StartNew();
            Parallel.For(
                0, assemblies.Count,
                delegate(int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    loader.DocumentationProvider = GetXmlDocumentation(assemblies[i].Location);
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            Debug.WriteLine("Init project content, loading base assemblies: " + total.Elapsed);
            projectContent = projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);
        }
开发者ID:gilgame,项目名称:SEWorkbench,代码行数:34,代码来源:CSharpCompletion.cs

示例3: Init

		void Init(string program)
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem();
			pc = pc.AddOrUpdateFiles(unresolvedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
		}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:10,代码来源:TypeSystemAstBuilderTests.cs

示例4: MockCSharpProject

		public MockCSharpProject(ISolution solution, string name)
			: base(new ProjectCreateInformation(solution, FileName.Create("c:\\projects\\" + name + "\\" + name + ".csproj")) {
			       	ProjectName = name,
			       	ActiveProjectConfiguration = new ConfigurationAndPlatform("Debug", "x86"),
			       	TargetFramework = TargetFramework.Net40Client,
			       })
		{
			OutputType = OutputType.Library;
			projectContent = new CSharpProjectContent().SetAssemblyName(name).SetProjectFileName(this.FileName);
			projectContent = projectContent.AddAssemblyReferences(NRefactoryHelper.Corlib);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:11,代码来源:MockCSharpProject.cs

示例5: SetUp

		public void SetUp()
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			unresolvedFile = SyntaxTree.Parse(program, "program.cs").ToTypeSystem();
			pc = pc.AddOrUpdateFiles(unresolvedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
			
			baseClass = compilation.RootNamespace.GetTypeDefinition("Base", 1);
			nestedClass = baseClass.NestedTypes.Single();
			derivedClass = compilation.RootNamespace.GetTypeDefinition("Derived", 2);
			systemClass = compilation.RootNamespace.GetChildNamespace("NS").GetTypeDefinition("System", 0);
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:15,代码来源:TypeSystemAstBuilderTests.cs

示例6: SetUp

		public void SetUp()
		{
			pc = new CSharpProjectContent();
			pc = pc.SetAssemblyName("MyAssembly");
			parsedFile = new CSharpParser().Parse(new StringReader(program), "program.cs").ToTypeSystem();
			pc = pc.UpdateProjectContent(null, parsedFile);
			pc = pc.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib });
			
			compilation = pc.CreateCompilation();
			
			baseClass = compilation.RootNamespace.GetTypeDefinition("Base", 1);
			nestedClass = baseClass.NestedTypes.Single();
			derivedClass = compilation.RootNamespace.GetTypeDefinition("Derived", 2);
			systemClass = compilation.FindType("NS.System, MyAssembly").GetDefinition();
		}
开发者ID:N3X15,项目名称:ILSpy,代码行数:15,代码来源:TypeSystemAstBuilderTests.cs

示例7: Minifier

        public Minifier(MinifierOptions options = null, string[] ignoredIdentifiers = null, string[] ignoredComments = null)
        {
            Options = options ?? new MinifierOptions();

            _projectContent = new CSharpProjectContent();
            var assemblies = new List<Assembly>
                {
                    typeof(object).Assembly, // mscorlib
                    typeof(Uri).Assembly, // System.dll
                    typeof(Enumerable).Assembly, // System.Core.dll
                };

            var unresolvedAssemblies = new IUnresolvedAssembly[assemblies.Count];
            Parallel.For(
                0, assemblies.Count,
                delegate (int i)
                {
                    var loader = new CecilLoader();
                    var path = assemblies[i].Location;
                    unresolvedAssemblies[i] = loader.LoadAssemblyFile(assemblies[i].Location);
                });
            _projectContent = _projectContent.AddAssemblyReferences((IEnumerable<IUnresolvedAssembly>)unresolvedAssemblies);

            IgnoredIdentifiers = ignoredIdentifiers == null ? new List<string>() : ignoredIdentifiers.ToList();
            IgnoredComments = new List<string>();
            if (ignoredComments != null)
                foreach (var comment in ignoredComments)
                {
                    var str = comment;
                    if (str.StartsWith("//"))
                        str = str.Substring("//".Length);
                    else if (str.StartsWith("/*") && str.EndsWith("*/"))
                        str = str.Substring("/*".Length, str.Length - "/*".Length - "*/".Length);
                    if (!IgnoredComments.Contains(str))
                        IgnoredComments.Add(str);
                }
        }
开发者ID:KvanTTT,项目名称:CSharp-Minifier,代码行数:37,代码来源:Minifier.cs

示例8: AddAllProjectReferences

        private static IProjectContent AddAllProjectReferences(Project msbuildProject, IProjectContent pc)
        {
            foreach (var item in msbuildProject.GetItems("ProjectReference"))
            {
                var referencedFileName = Path.Combine(msbuildProject.DirectoryPath, item.EvaluatedInclude);
                referencedFileName = Path.GetFullPath(referencedFileName);

                pc = pc.AddAssemblyReferences(new[] {new ProjectReference(referencedFileName)});
            }
            return pc;
        }
开发者ID:JoeHosman,项目名称:sharpDox,代码行数:11,代码来源:CSharpProject.cs

示例9: AddAllAssemblyReferences

 private IProjectContent AddAllAssemblyReferences(CSharpSolution solution, Project msbuildProject, IProjectContent pc)
 {
     foreach (var assemblyFile in ResolveAssemblyReferences(msbuildProject))
     {
         var assembly = solution.LoadAssembly(assemblyFile);
         pc = pc.AddAssemblyReferences(new[] { assembly });
     }
     return pc;
 }
开发者ID:JoeHosman,项目名称:sharpDox,代码行数:9,代码来源:CSharpProject.cs

示例10: CSharpProject

        public CSharpProject(
            ICSharpFileFactory cSharpFileFactory,
            MicrosoftBuildProject msBuildProject,
            string title)
        {
            Title = title;

            AssemblyName = msBuildProject.AssemblyName;
            FileName = msBuildProject.FileName;

            CompilerSettings =
                #region new CompilerSettings
                new CompilerSettings
                {
                    AllowUnsafeBlocks = msBuildProject.AllowUnsafeBlocks,
                    CheckForOverflow = msBuildProject.CheckForOverflowUnderflow,
                };

            CompilerSettings.ConditionalSymbols.AddRange(msBuildProject.DefineConstants);
            #endregion

            ProjectContent = new CSharpProjectContent();
            ProjectContent = ProjectContent.SetAssemblyName(msBuildProject.AssemblyName);
            ProjectContent = ProjectContent.SetProjectFileName(msBuildProject.FileName.FullPath);
            ProjectContent = ProjectContent.SetCompilerSettings(CompilerSettings);

            Files = msBuildProject.CompiledFileNames.Select(
                f => cSharpFileFactory.BuildCSharpFile(this, new FilePath(f))).ToList();

            ProjectContent = ProjectContent.AddOrUpdateFiles(
                Files.Select(f => f.UnresolvedTypeSystemForFile));

            ProjectContent = ProjectContent.AddAssemblyReferences(msBuildProject.ReferencedAssemblies);
        }
开发者ID:prescottadam,项目名称:pMixins,代码行数:34,代码来源:CSharpProject.cs


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