示例#1
0
        /// <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(EnvDTE.Project project, string repositoryPath, IEnumerable <PreinstalledPackageInfo> packageInfos)
        {
            var context       = new VSAPIProjectContext();
            var projectSystem = new VsMSBuildProjectSystem(_vsProjectAdapterProvider.CreateAdapterForFullyLoadedProject(project), context);

            foreach (var packageInfo in packageInfos)
            {
                var packagePath = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", packageInfo.Id, packageInfo.Version);

                CopyNativeBinaries(projectSystem, repositoryPath,
                                   Path.Combine(repositoryPath, packagePath));
            }
        }
示例#2
0
        private void CopyNativeBinaries(VsMSBuildProjectSystem 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);
                    }
                }
            }
        }
示例#3
0
        /// <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(EnvDTE.Project project, string repositoryPath, IEnumerable <PreinstalledPackageInfo> packageInfos)
        {
            var context = new VSAPIProjectContext
            {
                PackageExtractionContext = new PackageExtractionContext(
                    PackageSaveMode.Defaultv2,
                    PackageExtractionBehavior.XmlDocFileSaveMode,
                    ClientPolicyContext.GetClientPolicy(_settings, NullLogger.Instance),
                    NullLogger.Instance)
            };
            var projectSystem = new VsMSBuildProjectSystem(_vsProjectAdapterProvider.CreateAdapterForFullyLoadedProject(project), context);

            foreach (var packageInfo in packageInfos)
            {
                var packagePath = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", packageInfo.Id, packageInfo.Version);

                CopyNativeBinaries(projectSystem, repositoryPath,
                                   Path.Combine(repositoryPath, packagePath));
            }
        }
示例#4
0
        /// <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(EnvDTE.Project project, string repositoryPath, IEnumerable <PreinstalledPackageInfo> packageInfos)
        {
            var context = new VSAPIProjectContext();
            var signedPackageVerifier = new PackageSignatureVerifier(SignatureVerificationProviderFactory.GetSignatureVerificationProviders());

            context.PackageExtractionContext = new PackageExtractionContext(
                PackageSaveMode.Defaultv2,
                PackageExtractionBehavior.XmlDocFileSaveMode,
                new LoggerAdapter(context),
                signedPackageVerifier,
                SignedPackageVerifierSettings.GetDefault());
            var projectSystem = new VsMSBuildProjectSystem(_vsProjectAdapterProvider.CreateAdapterForFullyLoadedProject(project), context);

            foreach (var packageInfo in packageInfos)
            {
                var packagePath = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", packageInfo.Id, packageInfo.Version);

                CopyNativeBinaries(projectSystem, repositoryPath,
                                   Path.Combine(repositoryPath, packagePath));
            }
        }