Microsoft.Web.PlatformInstaller.WebDeployShim.dll reference removed;

DeploymentParameters interchange updated
This commit is contained in:
ruslanht 2012-09-14 17:37:59 +03:00
parent 3bea46c499
commit 4308f11407
6 changed files with 55 additions and 26 deletions

View file

@ -87,7 +87,7 @@ namespace WebsitePanel.Providers.WebAppGallery
//SiteUserPassword = 549755813888,
ALLKNOWN =
AllKnown =
AppHostConfig |
AppPoolConfig |
Boolean |
@ -155,5 +155,21 @@ namespace WebsitePanel.Providers.WebAppGallery
return String.Format("{0}=\"{1}\", Tags={2}", Name, Value, WellKnownTags.ToString());
}
#endif
public void SetWellKnownTagsFromRawString(string rawTags)
{
string[] tags = rawTags.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
DeploymentParameterWellKnownTag wellKnownTags = DeploymentParameterWellKnownTag.None;
foreach (string tag in tags)
{
try
{
wellKnownTags |= (DeploymentParameterWellKnownTag)Enum.Parse(typeof(DeploymentParameterWellKnownTag), tag, true);
}
catch(Exception){}
}
WellKnownTags = wellKnownTags & DeploymentParameterWellKnownTag.AllKnown;
}
}
}

View file

@ -44,6 +44,7 @@ using System.Web;
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Caching.Expirations;
using DeploymentParameter = WebsitePanel.Providers.WebAppGallery.DeploymentParameter;
using DeploymentParameterWPI = Microsoft.Web.PlatformInstaller.DeploymentParameter;
namespace WebsitePanel.Providers.Web.WPIWebApplicationGallery
{
@ -268,10 +269,10 @@ namespace WebsitePanel.Providers.Web.WPIWebApplicationGallery
Product product = wpi.GetProduct(id);
List<DeploymentParameter> deploymentParameters = new List<DeploymentParameter>();
IList<DeclaredParameter> appDecalredParameters = wpi.GetAppDecalredParameters(id);
foreach (DeclaredParameter declaredParameter in appDecalredParameters)
IList<DeploymentParameterWPI> appDeploymentWPIParameters = wpi.GetAppDecalredParameters(id);
foreach (DeploymentParameterWPI deploymentParameter in appDeploymentWPIParameters)
{
deploymentParameters.Add(MakeDeploymentParameterFromDecalredParameter(declaredParameter));
deploymentParameters.Add(MakeDeploymentParameterFromDecalredParameter(deploymentParameter));
}
return deploymentParameters;
@ -398,28 +399,41 @@ namespace WebsitePanel.Providers.Web.WPIWebApplicationGallery
};
}
protected static DeploymentParameter MakeDeploymentParameterFromDecalredParameter(DeclaredParameter d)
protected static DeploymentParameter MakeDeploymentParameterFromDecalredParameter(DeploymentParameterWPI d)
{
DeploymentParameter r = new DeploymentParameter();
r.Name = d.Name;
r.FriendlyName = d.FriendlyName;
r.DefaultValue = d.DefaultValue;
r.Description = d.Description;
#pragma warning disable 612,618
r.WellKnownTags = DeploymentParameterWellKnownTag.ALLKNOWN & (DeploymentParameterWellKnownTag) d.Tags;
if (null != d.Validation)
r.SetWellKnownTagsFromRawString(d.RawTags);
if (!string.IsNullOrEmpty(d.ValidationString))
{
r.ValidationKind = (DeploymentParameterValidationKind) d.Validation.Kind;
r.ValidationString = d.Validation.ValidationString;
// synchronized with Microsoft.Web.Deployment.DeploymentSyncParameterValidationKind
if (d.HasValidation((int)DeploymentParameterValidationKind.AllowEmpty))
{
r.ValidationKind |= DeploymentParameterValidationKind.AllowEmpty;
}
if (d.HasValidation((int)DeploymentParameterValidationKind.RegularExpression))
{
r.ValidationKind |= DeploymentParameterValidationKind.RegularExpression;
}
if (d.HasValidation((int)DeploymentParameterValidationKind.Enumeration))
{
r.ValidationKind |= DeploymentParameterValidationKind.Enumeration;
}
if (d.HasValidation((int)DeploymentParameterValidationKind.Boolean))
{
r.ValidationKind |= DeploymentParameterValidationKind.Boolean;
}
r.ValidationString = d.ValidationString;
}
else
{
r.ValidationKind = DeploymentParameterValidationKind.None;
}
#pragma warning restore 612,618
return r;
}

View file

@ -77,11 +77,6 @@
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Web.PlatformInstaller.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.PlatformInstaller.WebDeployShim, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Web.PlatformInstaller.WebDeployShim.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />

View file

@ -38,6 +38,7 @@ using System.Threading;
using Microsoft.Web.Deployment;
using Microsoft.Web.PlatformInstaller;
using Installer = Microsoft.Web.PlatformInstaller.Installer;
using DeploymentParameterWPI = Microsoft.Web.PlatformInstaller.DeploymentParameter;
namespace WebsitePanel.Server.Code
{
@ -453,11 +454,11 @@ namespace WebsitePanel.Server.Code
return products;
}
public IList<DeclaredParameter> GetAppDecalredParameters(string productId)
public IList<DeploymentParameterWPI> GetAppDecalredParameters(string productId)
{
Product app = _productManager.GetProduct(productId);
Installer appInstaller = app.GetInstaller(GetLanguage(null));
return appInstaller.MSDeployPackage.DeclaredParameters;
return appInstaller.MSDeployPackage.DeploymentParameters;
}
public bool InstallApplication(
@ -501,7 +502,7 @@ namespace WebsitePanel.Server.Code
DeploymentWellKnownTag dbTag = (DeploymentWellKnownTag)GetDbTag(updatedValues);
// remove parameters with alien db tags
foreach (DeclaredParameter parameter in appInstaller.MSDeployPackage.DeclaredParameters)
foreach (DeploymentParameterWPI parameter in appInstaller.MSDeployPackage.DeploymentParameters)
{
if (IsAlienDbTaggedParameter(dbTag, parameter))
{
@ -726,13 +727,16 @@ namespace WebsitePanel.Server.Code
return DeploymentWellKnownTag.None;
}
private static bool IsAlienDbTaggedParameter(DeploymentWellKnownTag dbTag, DeclaredParameter parameter)
private static bool IsAlienDbTaggedParameter(DeploymentWellKnownTag dbTag, DeploymentParameterWPI parameter)
{
return parameter.HasTags((long)databaseEngineTags) && !parameter.HasTags((long)dbTag);
/*
#pragma warning disable 612,618
return (parameter.Tags & databaseEngineTags) != DeploymentWellKnownTag.None
&&
(parameter.Tags & dbTag) == DeploymentWellKnownTag.None;
#pragma warning restore 612,618
*/
}
private static void RemoveUnusedProviders(MSDeployPackage msDeployPackage, DeploymentWellKnownTag dbTag)

View file

@ -155,7 +155,7 @@ namespace WebsitePanel.Portal
}
// MySQL Server
else if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.MySql) != null)
if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.MySql) != null)
{
// load package context
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
@ -170,15 +170,15 @@ namespace WebsitePanel.Portal
}
// SQLite
else if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.SqLite) != null)
if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.SqLite) != null)
AddDatabaseEngine(DeploymentParameterWellKnownTag.SqLite, "", GetLocalizedString("DatabaseEngine.SQLite"));
// Flat File
else if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.FlatFile) != null)
if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.FlatFile) != null)
AddDatabaseEngine(DeploymentParameterWellKnownTag.FlatFile, "", GetLocalizedString("DatabaseEngine.FlatFile"));
// VistaFB
else if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.VistaDB) != null)
if (FindParameterByTag(parameters, DeploymentParameterWellKnownTag.VistaDB) != null)
AddDatabaseEngine(DeploymentParameterWellKnownTag.VistaDB, "", GetLocalizedString("DatabaseEngine.VistaDB"));