Пример #1
0
        public void MsDeployProfile_ReturnsCorrectMsDeployPublishProfile()
        {
            MSDeployPublishProfile msDeployProfile = new MSDeployPublishProfile()
            {
                SiteUrlToLaunchAfterPublish = "https://webappwithdb.azurewebsites.net",
                LaunchSiteAfterPublish      = true,
                MSDeployServiceURL          = "webappwithdb.scm.azurewebsites.net:443",
                DeployIisAppPath            = "webappwithdb",
                UserName = "******"
            };

            Assert.Equal(TestResources.MSDeployPublishProfile, msDeployProfile.ToString());
        }
Пример #2
0
        public static PublishProfile CreatePublishProfile(string publishMethod)
        {
            PublishProfile publishProfile = null;

            switch (publishMethod)
            {
            case MSDeployPublishProfile.PublishMethod:
                publishProfile = new MSDeployPublishProfile();
                break;

            case MSDeployPackagePublishProfile.PublishMethod:
                publishProfile = new MSDeployPackagePublishProfile();
                break;

            case FileSystemPublishProfile.PublishMethod:
                publishProfile = new FileSystemPublishProfile();
                break;
            }

            return(publishProfile);
        }
        public static KeyValuePair <string, IMSDeployPublishProfile> CreateMSDeployPublishProfileFromPublishSettings(string publishSettingsContents)
        {
            using (XmlTextReader reader = new XmlTextReader(new StringReader(publishSettingsContents)))
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(reader);

                XmlNode root        = xmldoc.DocumentElement;
                XmlNode profileNode = root.FirstChild;
                for (; profileNode != null; profileNode = profileNode.NextSibling)
                {
                    XmlAttribute publishMethodAttr = null;
                    if (profileNode.Attributes != null)
                    {
                        publishMethodAttr = profileNode.Attributes["publishMethod"];
                    }

                    if (publishMethodAttr != null && !string.IsNullOrEmpty(publishMethodAttr.Value) && string.Equals(publishMethodAttr.Value, MSDeployPublishProfile.PublishMethod, StringComparison.Ordinal))
                    {
                        IMSDeployPublishProfile msDeployPublishProfile = new MSDeployPublishProfile()
                        {
                            MSDeployServiceURL          = profileNode.Attributes["publishUrl"]?.Value,
                            DeployIisAppPath            = profileNode.Attributes["msdeploySite"]?.Value,
                            SiteUrlToLaunchAfterPublish = profileNode.Attributes["destinationAppUrl"]?.Value,
                            LaunchSiteAfterPublish      = true,
                            UserName = profileNode.Attributes["userName"]?.Value
                        };

                        string profileName = profileNode.Attributes["profileName"]?.Value ?? "msDeployProfile";
                        return(new KeyValuePair <string, IMSDeployPublishProfile>(profileName, msDeployPublishProfile));
                    }
                }
            }

            return(new KeyValuePair <string, IMSDeployPublishProfile>());
        }