diff --git a/cmf-cli/Commands/new/DataCommand.cs b/cmf-cli/Commands/new/DataCommand.cs index 9de6fda78..4118184a3 100644 --- a/cmf-cli/Commands/new/DataCommand.cs +++ b/cmf-cli/Commands/new/DataCommand.cs @@ -72,7 +72,7 @@ protected override List GenerateArgs(IDirectoryInfo projectRoot, IDirect "--rootRelativePath", relativePathToRoot, "--repositoryType", repoType.ToString() }); - args.AddRange(new []{ "--targetFramework", DependencyVersionService.NET6TARGETFRAMEWORK }); + args.AddRange(new []{ "--targetFramework", ExecutionContext.ServiceProvider.GetService().DotNetTargetFramework(version) }); return args; } diff --git a/tests/Specs/New.cs b/tests/Specs/New.cs index f37c66095..729826b5a 100644 --- a/tests/Specs/New.cs +++ b/tests/Specs/New.cs @@ -208,6 +208,35 @@ public void Data() RunNew(new DataCommand(), "Cmf.Custom.Data"); } + [Fact, Trait("TestCategory", "Integration")] + public void Data_TargetFramework_Net8_For_MES11() + { + RunNew(new DataCommand(), "Cmf.Custom.Data", + extraAsserts: args => + { + var (_, dir) = args; + var actionsCsproj = Path.Combine(dir, "Cmf.Custom.Data", "DEEs", "Cmf.Custom.tenant.Actions.csproj"); + File.Exists(actionsCsproj).Should().BeTrue(); + var content = File.ReadAllText(actionsCsproj); + content.Should().Contain("net8.0"); + }); + } + + [Fact, Trait("TestCategory", "Integration")] + public void Data_TargetFramework_Net6_For_MES10() + { + RunNew(new DataCommand(), "Cmf.Custom.Data", + mesVersion: "10.2.0", + extraAsserts: args => + { + var (_, dir) = args; + var actionsCsproj = Path.Combine(dir, "Cmf.Custom.Data", "DEEs", "Cmf.Custom.tenant.Actions.csproj"); + File.Exists(actionsCsproj).Should().BeTrue(); + var content = File.ReadAllText(actionsCsproj); + content.Should().Contain("net6.0"); + }); + } + [Fact, Trait("TestCategory", "LongRunning"), Trait("TestCategory", "Integration")] public void Data_WithBusiness() {