Example #1
0
        public void DropDatabase(string connectionString)
        {
            SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(connectionString);
            RunHelpers run = new RunHelpers();

            run.SyncProcess(String.Format("sqlcmd -S {0} -U {1} -P {2} -Q \"DROP DATABASE {3};\"", csb.DataSource, csb.UserID, csb.Password, csb.InitialCatalog));
        }
Example #2
0
        public void ForceDropConnections(string connectionString)
        {
            SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder(connectionString);
            RunHelpers run = new RunHelpers();

            run.SyncProcess(String.Format("sqlcmd -S {0} -U {1} -P {2} -Q \"ALTER DATABASE {3} SET OFFLINE WITH ROLLBACK IMMEDIATE;\"", csb.DataSource, csb.UserID, csb.Password, csb.InitialCatalog));
            run.SyncProcess(String.Format("sqlcmd -S {0} -U {1} -P {2} -Q \"ALTER DATABASE {3} SET ONLINE;\"", csb.DataSource, csb.UserID, csb.Password, csb.InitialCatalog));
        }
Example #3
0
        public void RunDeploymentProfile(string project, string publishProfile, string username, string password, string compilerPath = "c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe")
        {
            var path = GetSolutionDirectoryPath();

            if (string.IsNullOrEmpty(path))
            {
                throw new Exception("Could not find solution directory.");
            }

            var projectFilePath = GetProjectFilePath(path, project);
            RunHelpers run = new RunHelpers();

            var command = string.Format("{0} {1} /p:DeployOnBuild=true /p:PublishProfile=\"{2}\" /p:AllowUntrustedCertificate=True /p:username={3} /p:password={4}", compilerPath, projectFilePath, publishProfile, username, password);

            run.SyncProcess(command);
        }