Gruntjs没有正确地继承任务中的选项

时间:2014-01-16 20:58:02

标签: gruntjs

以下是我的Gruntfile的一部分。运行'$ grunt msbuild:migrate:local'工作正常,但'$ grunt msbuild:migrate:dev'似乎并没有拉入我的ConnectionString属性。我是否正确组织了正确继承的选项?

msbuild: {
    src: ['Web Platform\Web Platform.csproj'],
    options: {
        projectConfiguration: 'Dev',
        targets: ['Clean', 'Rebuild'],
        maxCpuCount: 4,
        verbosity: 'minimal',
        stdout: true,
        buildParameters: {
            WarningLevel: 2,
            DeployOnBuild: false,
            Configuration: 'Dev',
        },
    },
    migrate: {
        // Defaults -----------------------------------------
        src: ['Migrate.msbuild'],
        options: {
                targets: ['Migrate'],
                buildParameters: {
                    DryRun: 'False',
                    Verbose: 'False',
                    RollbackSteps: '1',
                },
                verbosity: 'minimal',
        },
        // Tasks -----------------------------------------
        local: {
            // Uses defaults from above (I hope)
        },
        dev: {
            options: {
                buildParameters: {
                    ConnectionString: 'Data Source=<%= credentials.aws_rds_hostname %>,1433;Initial Catalog=DevDatabase;User ID=<%= credentials.aws_rds_admin_username %>;Password=<%= credentials.aws_rds_admin_password %>'
                }
            }
        }   
    }
}

1 个答案:

答案 0 :(得分:1)

Grunt不支持深层嵌套任务。这里唯一可以运行的是“grunt msbuild:migrate”(继承全局配置,由自己的配置覆盖)

例如,请参阅this ticket