本文整理汇总了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);
}
}
示例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);
}
示例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();
}