/// <summary> /// By convention, we copy all files under the NativeBinaries folder under package root to the bin folder of /// the Website. /// </summary> /// <param name="project">The target Website project.</param> /// <param name="repositoryPath">The local repository path.</param> /// <param name="packageInfos">The packages that were installed.</param> private void CopyNativeBinariesToBin(Project project, string repositoryPath, IEnumerable <PreinstalledPackageInfo> packageInfos) { VSAPIProjectContext context = new VSAPIProjectContext(); VSMSBuildNuGetProjectSystem projectSystem = new VSMSBuildNuGetProjectSystem(project, context); foreach (var packageInfo in packageInfos) { string packagePath = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", packageInfo.Id, packageInfo.Version); CopyNativeBinaries(projectSystem, repositoryPath, Path.Combine(repositoryPath, packagePath)); } }
private void CopyNativeBinaries(VSMSBuildNuGetProjectSystem projectSystem, string repositoryPath, string packagePath) { const string nativeBinariesFolder = "NativeBinaries"; const string binFolder = "bin"; DirectoryInfo nativeBinariesPath = new DirectoryInfo(Path.Combine(packagePath, nativeBinariesFolder)); if (nativeBinariesPath.Exists) { FileInfo[] nativeFiles = nativeBinariesPath.GetFiles("*.*", SearchOption.AllDirectories); foreach (FileInfo file in nativeFiles) { string targetPath = Path.Combine(binFolder, file.FullName.Substring(nativeBinariesPath.FullName.Length + 1)); // skip over NativeBinaries/ word using (Stream stream = file.OpenRead()) { projectSystem.AddFile(targetPath, stream); } } } }
private void CopyNativeBinaries(VSMSBuildNuGetProjectSystem projectSystem, string repositoryPath, string packagePath) { const string nativeBinariesFolder = "NativeBinaries"; const string binFolder = "bin"; DirectoryInfo nativeBinariesPath = new DirectoryInfo(Path.Combine(packagePath, nativeBinariesFolder)); if (nativeBinariesPath.Exists) { FileInfo[] nativeFiles = nativeBinariesPath.GetFiles("*.*", SearchOption.AllDirectories); foreach (FileInfo file in nativeFiles) { string targetPath = Path.Combine(binFolder, file.FullName.Substring(nativeBinariesPath.FullName.Length + 1)); // skip over NativeBinaries/ word using (Stream stream = file.OpenRead()) { projectSystem.AddFile(targetPath, stream); } } } }
/// <summary> /// By convention, we copy all files under the NativeBinaries folder under package root to the bin folder of the Website. /// </summary> /// <param name="project">The target Website project.</param> /// <param name="repositoryPath">The local repository path.</param> /// <param name="packageInfos">The packages that were installed.</param> private void CopyNativeBinariesToBin(Project project, string repositoryPath, IEnumerable<PreinstalledPackageInfo> packageInfos) { VSAPIProjectContext context = new VSAPIProjectContext(); VSMSBuildNuGetProjectSystem projectSystem = new VSMSBuildNuGetProjectSystem(project, context); foreach (var packageInfo in packageInfos) { string packagePath = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", packageInfo.Id, packageInfo.Version); CopyNativeBinaries(projectSystem, repositoryPath, Path.Combine(repositoryPath, packagePath)); } }