/// <summary> /// Install all of the packages from the specified packages.config file /// </summary> /// <param name="binariesOnly">Only install binaries (do not modify web.config)</param> public IEnumerable <string> InstallPackages(string sitePhysicalPath, string packagesConfigPath, string source = "", bool binariesOnly = true, Version targetFramework = null) { if (string.IsNullOrEmpty(packagesConfigPath)) { throw new ArgumentNullException("packagesConfig"); } // parse config and get all packages if (!_fileSystem.FileExists(packagesConfigPath)) { throw new FileNotFoundException(string.Format("Packages config was not found at: '{0}'.", packagesConfigPath)); } XmlDocument doc = new XmlDocument(); doc.LoadXml(_fileSystem.FileReadAllText(packagesConfigPath)); List <PackageName> packages = new List <PackageName>(); XmlNodeList xmlPackages = doc.GetElementsByTagName("package"); foreach (XmlNode p in xmlPackages) { PackageName package = new PackageName(p.Attributes["id"].Value, new SemanticVersion(p.Attributes["version"].Value)); packages.Add(package); if (p.Attributes["source"] != null && !string.IsNullOrEmpty(p.Attributes["source"].Value)) { source += (";" + p.Attributes["source"].Value); } } return(InstallPackages(sitePhysicalPath, packages, source.Trim(';'), binariesOnly, targetFramework)); }
internal IEnumerable <string> GetAssemblyReferencePaths() { Core.Abstractions.IFileSystem fileSystem = Dependencies.FileSystem; HashSet <string> referenceList = new HashSet <string>(); var references = project.GetItemsWithMetadataProperty("Reference", "HintPath"); foreach (var name in references.Keys) { var assemblyPath = references[name]; if (!Path.IsPathRooted(assemblyPath)) { // make sure these are absolute paths, as anybody other than this project won't know the root. assemblyPath = PathUtility.GetAbsolutePath(PathUtility.EnsureTrailingSlash(Root), assemblyPath); } if (fileSystem.FileExists(assemblyPath)) { referenceList.Add(assemblyPath); } } return(referenceList); }