本文整理汇总了C#中Project.GetAssemblyClosure方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetAssemblyClosure方法的具体用法?C# Project.GetAssemblyClosure怎么用?C# Project.GetAssemblyClosure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.GetAssemblyClosure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBindingRedirects
private static IEnumerable<AssemblyBinding> AddBindingRedirects(
Project project,
IFileSystemProvider fileSystemProvider,
AppDomain domain,
IDictionary<string, HashSet<string>> projectAssembliesCache,
IVsFrameworkMultiTargeting frameworkMultiTargeting)
{
var redirects = Enumerable.Empty<AssemblyBinding>();
// Create a project system
IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project, fileSystemProvider);
// Run this on the UI thread since it enumerates all references
IEnumerable<string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(fileSystemProvider, projectAssembliesCache));
redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain);
if (frameworkMultiTargeting != null)
{
// filter out assemblies that already exist in the target framework (CodePlex issue #3072)
FrameworkName targetFrameworkName = project.GetTargetFrameworkName();
redirects = redirects.Where(p => !FrameworkAssemblyResolver.IsHigherAssemblyVersionInFramework(p.Name, p.AssemblyNewVersion, targetFrameworkName, fileSystemProvider));
}
// Create a binding redirect manager over the configuration
var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile());
// Add the redirects
manager.AddBindingRedirects(redirects);
return redirects;
}
示例2: AddBindingRedirects
private static IEnumerable<AssemblyBinding> AddBindingRedirects(Project project, AppDomain domain, IDictionary<string, HashSet<string>> projectAssembliesCache)
{
var redirects = Enumerable.Empty<AssemblyBinding>();
// Only add binding redirects to projects that aren't class libraries
if (project.SupportsConfig()) {
// Create a project system
IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project);
// Run this on the UI thread since it enumerates all references
IEnumerable<string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(projectAssembliesCache));
redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain);
// Create a binding redirect manager over the configuration
var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile());
// Add the redirects
manager.AddBindingRedirects(redirects);
}
return redirects;
}
示例3: AddBindingRedirects
private static IEnumerable<AssemblyBinding> AddBindingRedirects(
Project project,
IFileSystemProvider fileSystemProvider,
AppDomain domain,
IDictionary<string, HashSet<string>> projectAssembliesCache,
IVsFrameworkMultiTargeting frameworkMultiTargeting,
bool checkProjectType = true)
{
var redirects = Enumerable.Empty<AssemblyBinding>();
// Only add binding redirects to projects that aren't class libraries
if (!checkProjectType || project.SupportsConfig())
{
// Create a project system
IFileSystem fileSystem = VsProjectSystemFactory.CreateProjectSystem(project, fileSystemProvider);
// Run this on the UI thread since it enumerates all references
IEnumerable<string> assemblies = ThreadHelper.Generic.Invoke(() => project.GetAssemblyClosure(fileSystemProvider, projectAssembliesCache));
redirects = BindingRedirectResolver.GetBindingRedirects(assemblies, domain);
if (frameworkMultiTargeting != null)
{
// filter out assemblies that already exist in the target framework (CodePlex issue #3072)
string targetFramework = project.GetTargetFramework();
redirects = redirects.Where(p => !IsAssemblyAvaialbleInFramework(p.Name, targetFramework, frameworkMultiTargeting));
}
// Create a binding redirect manager over the configuration
var manager = new BindingRedirectManager(fileSystem, project.GetConfigurationFile());
// Add the redirects
manager.AddBindingRedirects(redirects);
}
return redirects;
}