本文整理汇总了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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
}