aws-cdk
aws-cdk copied to clipboard
can not initialize EnvironmentVariables
how to initialize EnvironmentVariables in codebuild project?
Reproduction Steps
var project = new PipelineProject(this, "Build", new PipelineProjectProps
{
ProjectName = "BuildTest",
BuildSpec = BuildSpec.FromSourceFilename("buildspec.yml"),
Environment = new BuildEnvironment
{
BuildImage = LinuxBuildImage.FromDockerRegistry("mcr.microsoft.com/dotnet/core/sdk:3.1"),
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable>
{
["PROJECT_DIR"] = new BuildEnvironmentVariable { Value = "myproject", Type = BuildEnvironmentVariableType.PLAINTEXT }
}
}
});
Error Log
Implicitly type 'System.Collections.Generic.Dictionary <string, Amazon.CDK.AWS.CodeBuild.BuildEnvironmentVariable>' type 'System.Collections.Generic.IDictionary <string, Amazon.CDK.AWS.CodeBuild.IBuildEnvironmentVariable>' Could not convert to There is an explicit conversion. Make sure you have a cast.
Environment
- CLI Version : aws-cli/1.16.83 Python/3.7.2 Windows/10 botocore/1.12.73
- Framework Version: dotnet 3.1.100 / Amazon.CDK.AWS.CodeBuild v.1.18.0
- OS : windows
- Language : c#
Other
This is :bug: Bug Report
@bruce-igaw try
var project = new PipelineProject(this, "Build", new PipelineProjectProps
{
ProjectName = "BuildTest",
BuildSpec = BuildSpec.FromSourceFilename("buildspec.yml"),
Environment = new BuildEnvironment
{
BuildImage = LinuxBuildImage.FromDockerRegistry("mcr.microsoft.com/dotnet/core/sdk:3.1"),
EnvironmentVariables = new Dictionary<string, IBuildEnvironmentVariable>
{
["PROJECT_DIR"] = new BuildEnvironmentVariable { Value = "myproject", Type = BuildEnvironmentVariableType.PLAINTEXT }
}
}
});
@pushthat thank you!!