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


C# ISolution.GetProject方法代码示例

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


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

示例1: Compile

        private static void Compile(ISolution solution)
        {
            var workspaceServices = (IHaveWorkspaceServices)solution;
            var projectDependencyService = workspaceServices.WorkspaceServices.GetService<IProjectDependencyService>();

            foreach (var projectId in projectDependencyService.GetDependencyGraph(solution).GetTopologicallySortedProjects())
            {
                var currentDomain = AppDomain.CurrentDomain;
                var assemblyName = new AssemblyName();
                assemblyName.Name = "Most." + solution.GetProject(projectId).AssemblyName;

                var assemblyBuilder = currentDomain.DefineDynamicAssembly
                               (assemblyName, AssemblyBuilderAccess.RunAndSave);

                var moduleBuilder = assemblyBuilder.
                                                DefineDynamicModule(assemblyName.Name);
                var types = moduleBuilder.GetTypes();
                types.Aggregate((ts, t) =>
                {
                    var tb = t as TypeBuilder;
                    return tb.CreateType();
                });
                solution.GetProject(projectId).GetCompilation().Emit(moduleBuilder);
                assemblyBuilder.Save(assemblyName.Name);
            }
        }
开发者ID:runefs,项目名称:Interact,代码行数:26,代码来源:Program.cs

示例2: CreateSubmissionProject

        private IProject CreateSubmissionProject(ISolution solution)
        {
            var name = "Submission#" + _documentNumber++;
            var projectId = ProjectId.CreateNewId(solution.Id, name);

            var version = VersionStamp.Create();
            var compilationOptions = _compilationOptions.WithScriptClassName(name);

            var projectInfo = new ProjectInfo(
                projectId,
                version,
                name,
                name,
                LanguageNames.CSharp,
                compilationOptions: compilationOptions,
                parseOptions: _parseOptions,
                metadataReferences: _references,
                isSubmission: true);

            solution = solution.AddProject(projectInfo);

            if (_previousProjectId != null)
            {
                solution = solution.AddProjectReference(projectId, _previousProjectId);
            }

            return solution.GetProject(projectId);
        }
开发者ID:Wagnerp,项目名称:scriptcs-editor,代码行数:28,代码来源:ScriptManager.cs

示例3: Execute

        /// <summary>Executes action. Called after Update, that set <c>ActionPresentation</c>.Enabled to true.</summary>
        /// <param name="solution">The solution.</param>
        /// <param name="context">The context.</param>
        private void Execute(ISolution solution, IDataContext context)
        {
            this.solution = solution;
              this.currentFile = GetCurrentFile(this.solution, context);

              var items = new List<SimpleMenuItem>();

              var files = FavoriteFilesSettings.Instance.FavoriteFiles;

              var index = 0;

              foreach (var favoriteFilePath in files)
              {
            var path = favoriteFilePath;

            if (string.IsNullOrEmpty(favoriteFilePath.ProjectName))
            {
              var item = DescribeFavoriteFile(favoriteFilePath, index);

              item.Clicked += delegate { this.MenuItemClicked(path); };

              items.Add(item);

              index++;

              continue;
            }

            var project = solution.GetProject(favoriteFilePath.ProjectName);

            if (project != null)
            {
              var item = DescribeFavoriteFile(favoriteFilePath, index);

              item.Clicked += delegate { this.MenuItemClicked(path); };

              items.Add(item);

              index++;

              continue;
            }
              }

              if (items.Count > 0)
              {
            items.Add(SimpleMenuItem.CreateSeparator());
              }

              items.Add(this.DescribeAddMenuItem());
              items.Add(this.DescribeOrganizeMenuItem());

              var menu = new JetPopupMenu();

              menu.Caption.Value = WindowlessControl.Create("Favorite Files");
              menu.SetItems(items.ToArray());
              menu.KeyboardAcceleration.SetValue(KeyboardAccelerationFlags.Mnemonics);

              menu.Show();
        }
开发者ID:jamiebriant,项目名称:agentjohnson,代码行数:63,代码来源:FavoriteFilesActionHandler.cs


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