/// <summary>
        /// Gets the full path to the installer file that will be generated by
        /// the Wix compiler and linker.
        /// </summary>
        public FileName GetInstallerFullPath()
        {
            string outputPath = GetEvaluatedPropertyOrEmptyString("OutputPath");
            string outputType = GetEvaluatedPropertyOrEmptyString("OutputType");
            string outputName = GetEvaluatedPropertyOrEmptyString("OutputName");
            string fileName   = String.Concat(outputName, GetInstallerExtension(outputType));

            return(Directory.CombineDirectory(outputPath).CombineFile(fileName));
        }
示例#2
0
        public override void ExecuteOperation()
        {
            var destinationDirectory = Directory.CombineDirectory("Databases");

            if (!destinationDirectory.Exists)
            {
                FileSystem.CreateDirectory(destinationDirectory.Path);
            }

            var destinationFile = destinationDirectory.CombineFile(SqlDatabase.Database + ".bak");

            using (var connection = new SqlConnection(SqlDatabase.Server.GetConnectionString()))
            {
                connection.Open();

                var command = new SqlCommand();
                command.Connection  = connection;
                command.CommandText = string.Format(@"BACKUP DATABASE [{0}] TO DISK = '{1}' WITH DESCRIPTION = '{2:yyyy-MM-dd HH:mm:ss}'", SqlDatabase.Database, destinationFile.Path, Context.ServiceContainer.Get <IDateTimeService>().GetCurrentDateTime());
                command.ExecuteNonQuery();
            }
        }