Пример #1
0
		private void DoAddNuget(ILogger logger, INugetSpec nugetComponent, IComponentFinder components, string packagesOutputDirectory, bool firstlevel)
		{
			try {
				if (Dependencies.Any(c => c.Equals(nugetComponent))) {
					if (firstlevel)
						logger.Info("Component already references nuget {0}", nugetComponent.Name);
				} else {
					AddToPackagesConfig(nugetComponent, PackagesConfigFilePath);
					_dependencies.Add(new NugetReference(nugetComponent));
					var framework = nugetComponent.CompatibleFramework(_targetFrameworkVersion);
					foreach (var assembly in nugetComponent.AssemblyNames)
						FullPath.TransformFile(xml => AddSingleLibReference(xml, nugetComponent.Name, assembly, framework, RelativeInstalledPackagesDir));
				}
				foreach (var subdependency in nugetComponent.Dependencies) {
					var dep = components.FindComponent<INugetSpec>("^" + subdependency.Name + "$", interactive: false);
					if (dep != null)
						DoAddNuget(logger, dep, components, packagesOutputDirectory, false);
				}
				if (!Directory.Exists(InstalledPackagesDir.Combine(nugetComponent.Name)))
					BuildHelper.InstallPackage(logger, nugetComponent, InstalledPackagesDir, packagesOutputDirectory);
			} catch (Exception e) {
				logger.ErrorDetail("Could not add all recursive references of needed nugets. Cause: {0}", e.Message);
			}
		}
Пример #2
0
 /// <summary>
 /// 组件管理器构造函数。
 /// </summary>
 /// <param name="iocManager">IoC 管理器</param>
 /// <param name="componentFinder">组件查找器</param>
 public ComponentManager(IIocManager iocManager, IComponentFinder componentFinder)
 {
     _iocManager      = iocManager;
     _componentFinder = componentFinder;
     _components      = new ComponentCollection();
 }
Пример #3
0
		public virtual bool AddNuget(ILogger logger, INugetSpec nugetComponent, IComponentFinder components, string packagesOutputDirectory)
		{
			DoAddNuget(logger, nugetComponent, components, packagesOutputDirectory, true);
			return true;
		}