I am currently working on AWS moderization workshop. When I add the Amazon.CDK.AWS.EC2 nuget library and build the application, I get the following errors:
The application uses the latest Amazon. CDK.Lib, Contructs, Amazon.CDK.AWS.EC2 libraries from Nuget. I have also tried to run the command npm update -g aws-cdk
using troubleshooting steps documented in https://docs.aws.amazon.com/cdk/v2/guide/troubleshooting.html#troubleshooting_toolkit but that has not helped.
What am I missing?
Build errors:
Rebuild started...
1>------ Rebuild All started: Project: NorthwindCdk, Configuration: Debug Any CPU ------
Restored C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj (in 54 ms).
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.EC2 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.CloudWatch 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.IAM 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.KMS 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.Logs 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.S3.Assets 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.S3 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.SSM 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.Assets 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdk.csproj : warning NU1608: Detected package version outside of dependency constraint: Amazon.CDK.AWS.Events 1.137.0 requires Constructs (>= 3.3.69 && < 4.0.0) but version Constructs 10.0.22 was resolved.
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdkStack.cs(7,38,7,43): error CS0433: The type 'Stack' exists in both 'Amazon.CDK.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Amazon.CDK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdkStack.cs(9,36,9,45): error CS0104: 'Construct' is an ambiguous reference between 'Amazon.CDK.Construct' and 'Constructs.Construct'
1>C:\Users\12146\northwind-cdk\src\NorthwindCdk\NorthwindCdkStack.cs(9,64,9,75): error CS0433: The type 'IStackProps' exists in both 'Amazon.CDK.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Amazon.CDK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
1>Done building project "NorthwindCdk.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
NorthwindCdk.cs:
using Amazon.CDK;
using Constructs;
using Amazon.CDK.AWS.EC2;
namespace NorthwindCdk
{
public class NorthwindCdkStack : Stack
{
internal NorthwindCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
var vpc = new Vpc(this, "LabVpc", new VpcProps
{
MaxAzs = 2
});
}
}
}