当前位置: 首页>>代码示例>>C#>>正文


C# Project.IsWebSite方法代码示例

本文整理汇总了C#中Project.IsWebSite方法的典型用法代码示例。如果您正苦于以下问题:C# Project.IsWebSite方法的具体用法?C# Project.IsWebSite怎么用?C# Project.IsWebSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


在下文中一共展示了Project.IsWebSite方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnablePackageRestore

        private void EnablePackageRestore(Project project)
        {
            if (project.IsWebSite())
            {
                // Can't do anything with Website
                return;
            }

            if (!VsVersionHelper.IsVisualStudio2010 &&
                (project.IsJavaScriptProject() ||  project.IsNativeProject()))
            {
                if (VsVersionHelper.IsVisualStudio2012)
                {
                    EnablePackageRestoreInVs2012(project);
                }
                else
                {
                    EnablePackageRestoreInVs2013(project);
                }
            }
            else
            {
                MsBuildProject buildProject = project.AsMSBuildProject();
                EnablePackageRestore(project, buildProject, saveProjectWhenDone: true);
            }
        }
开发者ID:Mailaender,项目名称:xamarin-nuget,代码行数:26,代码来源:PackageRestoreManager.cs

示例2: PerformPackageInstall

        /// <summary>
        /// Installs one or more packages into the specified project.
        /// </summary>
        /// <param name="packageInstaller">The package installer service that performs the actual package installation.</param>
        /// <param name="project">The target project for installation.</param>
        /// <param name="configuration">The packages to install, where to install them from, and additional options for their installation.</param>
        /// <param name="repositorySettings">The repository settings for the packages being installed.</param>
        /// <param name="warningHandler">An action that accepts a warning message and presents it to the user, allowing execution to continue.</param>
        /// <param name="errorHandler">An action that accepts an error message and presents it to the user, allowing execution to continue.</param>
        internal void PerformPackageInstall(
            IVsPackageInstaller packageInstaller,
            Project project,
            PreinstalledPackageConfiguration configuration,
            Lazy<IRepositorySettings> repositorySettings,
            Action<string> warningHandler,
            Action<string> errorHandler)
        {
            string repositoryPath = configuration.RepositoryPath;
            var failedPackageErrors = new List<string>();

            IPackageRepository repository = configuration.IsPreunzipped
                                                ? (IPackageRepository)new UnzippedPackageRepository(repositoryPath)
                                                : (IPackageRepository)new LocalPackageRepository(repositoryPath);

            foreach (var package in configuration.Packages)
            {
                // Does the project already have this package installed?
                if (_packageServices.IsPackageInstalled(project, package.Id))
                {
                    // If so, is it the right version?
                    if (!_packageServices.IsPackageInstalled(project, package.Id, package.Version))
                    {
                        // No? Raise a warning (likely written to the Output window) and ignore this package.
                        warningHandler(String.Format(VsResources.PreinstalledPackages_VersionConflict, package.Id, package.Version));
                    }
                    // Yes? Just silently ignore this package!
                }
                else
                {
                    try
                    {
                        if (InfoHandler != null)
                        {
                            InfoHandler(String.Format(CultureInfo.CurrentCulture, VsResources.PreinstalledPackages_PackageInstallStatus, package.Id, package.Version));
                        }

                        packageInstaller.InstallPackage(repository, project, package.Id, package.Version.ToString(), ignoreDependencies: true, skipAssemblyReferences: package.SkipAssemblyReferences);
                    }
                    catch (InvalidOperationException exception)
                    {
                        failedPackageErrors.Add(package.Id + "." + package.Version + " : " + exception.Message);
                    }
                }
            }

            if (failedPackageErrors.Any())
            {
                var errorString = new StringBuilder();
                errorString.AppendFormat(VsResources.PreinstalledPackages_FailedToInstallPackage, repositoryPath);
                errorString.AppendLine();
                errorString.AppendLine();
                errorString.Append(String.Join(Environment.NewLine, failedPackageErrors));

                errorHandler(errorString.ToString());
            }

            // RepositorySettings = null in unit tests
            if (project.IsWebSite() && repositorySettings != null)
            {
                using (_vsCommonOperations.SaveSolutionExplorerNodeStates(_solutionManager))
                {
                    CreateRefreshFilesInBin(
                        project,
                        repositorySettings.Value.RepositoryPath,
                        configuration.Packages.Where(p => p.SkipAssemblyReferences));

                    CopyNativeBinariesToBin(project, repositorySettings.Value.RepositoryPath, configuration.Packages);
                }
            }
        }
开发者ID:kumavis,项目名称:NuGet,代码行数:80,代码来源:PreinstalledPackageInstaller.cs

示例3: TemplateFinishedGenerating

        private void TemplateFinishedGenerating(Project project)
        {
            foreach (var configuration in _configurations)
            {
                if (configuration.Packages.Any())
                {
                    PerformPackageInstall(_installer, project, configuration);

                    // RepositorySettings = null in unit tests
                    if (project.IsWebSite() && RepositorySettings != null)
                    {
                        using (_vsCommonOperations.SaveSolutionExplorerNodeStates(_solutionManager))
                        {
                            CreateRefreshFilesInBin(
                                project,
                                RepositorySettings.Value.RepositoryPath,
                                configuration.Packages.Where(p => p.SkipAssemblyReferences));

                            CopyNativeBinariesToBin(project, RepositorySettings.Value.RepositoryPath, configuration.Packages);
                        }
                    }
                }
            }
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:24,代码来源:VsTemplateWizard.cs

示例4: EnablePackageRestore

        private void EnablePackageRestore(Project project)
        {
            if (project.IsWebSite() || project.IsJavaScriptProject())
            {
                // Can't do anything with Website
                // Also, the Javascript Metro project system has some weird bugs 
                // that cause havoc with the package restore mechanism
                return;
            }

            MsBuildProject buildProject = project.AsMSBuildProject();

            AddSolutionDirProperty(project, buildProject);
            AddNuGetTargets(project, buildProject);
            SetMsBuildProjectProperty(project, buildProject, "RestorePackages", "true");

            if (project.IsJavaScriptProject())
            {
                // JavaScript project requires an extra kick
                // in order to save changes to the project file.
                // TODO: Check with VS team to ask them to fix 
                buildProject.Save();
            }
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:24,代码来源:PackageRestoreManager.cs

示例5: EnablePackageRestore

        private void EnablePackageRestore(Project project)
        {
            if (project.IsWebSite())
            {
                // Can't do anything with Website
                // Also, the Javascript Metro project system has some weird bugs 
                // that cause havoc with the package restore mechanism
                return;
            }

            if (project.IsJavaScriptProject())
            {
                EnablePackageRestoreForJavaScriptProject(project);
            }
            else
            {
                MsBuildProject buildProject = project.AsMSBuildProject();
                EnablePackageRestore(project, buildProject, saveProjectWhenDone: true);
            }
        }
开发者ID:atheken,项目名称:nuget,代码行数:20,代码来源:PackageRestoreManager.cs

示例6: EnablePackageRestore

        private void EnablePackageRestore(Project project)
        {
            if (project.IsWebSite())
            {
                // Can't do anything with Website
                return;
            }

            if (!VsVersionHelper.IsVisualStudio2010 && 
                (project.IsJavaScriptProject() ||  project.IsNativeProject()))
            {
                project.DoWorkInWriterLock(
                    buildProject => EnablePackageRestore(project, buildProject, saveProjectWhenDone: false));

                // When inside the Write lock, calling Project.Save() will cause a deadlock.
                // Thus we will save it after and outside of the Write lock.
                project.Save();
            }
            else
            {
                MsBuildProject buildProject = project.AsMSBuildProject();
                EnablePackageRestore(project, buildProject, saveProjectWhenDone: true);
            }
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:24,代码来源:PackageRestoreManager.cs

示例7: TemplateFinishedGenerating

        private void TemplateFinishedGenerating(Project project)
        {
            if (_configuration.Packages.Any())
            {
                PerformPackageInstall(_installer, project, _configuration);

                // RepositorySettings = null in unit tests
                if (project.IsWebSite() && RepositorySettings != null)
                {
                    CreateRefreshFilesInBin(
                        project,
                        RepositorySettings.Value.RepositoryPath,
                        _configuration.Packages.Where(p => p.SkipAssemblyReferences));

                    CopyNativeBinariesToBin(project, RepositorySettings.Value.RepositoryPath, _configuration.Packages);
                }
            }
        }
开发者ID:xero-github,项目名称:Nuget,代码行数:18,代码来源:VsTemplateWizard.cs

示例8: EnablePackageRestore

        private void EnablePackageRestore(Project project)
        {
            if (project.IsWebSite())
            {
                // Can't do anything with Website
                return;
            }

            MsBuildProject buildProject = project.AsMSBuildProject();

            AddSolutionDirProperty(project, buildProject);
            AddNuGetTargets(project, buildProject);
            SetMsBuildProjectProperty(project, buildProject, "RestorePackages", "true");

            if (project.IsJavaScriptProject())
            {
                // JavaScript project requires an extra kick
                // in order to save changes to the project file.
                // TODO: Check with VS team to ask them to fix 
                buildProject.Save();
            }
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:22,代码来源:PackageRestoreManager.cs


注:本文中的Project.IsWebSite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。