@@ -391,14 +391,10 @@ public async Task EndToEnd_MultiProjectSolution()
391391 . Execute ( )
392392 . Should ( ) . Pass ( ) ;
393393
394- // Add 'EnableSdkContainerSupport' property to the ConsoleApp and set TFM
394+ // set TFM for the console app
395395 using ( FileStream stream = File . Open ( Path . Join ( newSolutionDir . FullName , "ConsoleApp" , "ConsoleApp.csproj" ) , FileMode . Open , FileAccess . ReadWrite ) )
396396 {
397397 XDocument document = await XDocument . LoadAsync ( stream , LoadOptions . None , CancellationToken . None ) ;
398- document
399- . Descendants ( )
400- . First ( e => e . Name . LocalName == "PropertyGroup" ) ?
401- . Add ( new XElement ( "EnableSdkContainerSupport" , "true" ) ) ;
402398 document
403399 . Descendants ( )
404400 . First ( e => e . Name . LocalName == "TargetFramework" )
@@ -512,6 +508,8 @@ public async Task EndToEnd_MultiProjectSolution_with_multitargeted_library()
512508 [ InlineData ( "webapi" , true ) ]
513509 [ InlineData ( "worker" , false ) ]
514510 [ InlineData ( "worker" , true ) ]
511+ [ InlineData ( "console" , true ) ]
512+ [ InlineData ( "console" , false ) ]
515513 public async Task EndToEnd_NoAPI_ProjectType ( string projectType , bool addPackageReference )
516514 {
517515 DirectoryInfo newProjectDir = new ( Path . Combine ( TestSettings . TestArtifactsDirectory , $ "CreateNewImageTest_{ projectType } _{ addPackageReference } ") ) ;
@@ -564,7 +562,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
564562 var project = XDocument . Load ( projectPath ) ;
565563 var ns = project . Root ? . Name . Namespace ?? throw new InvalidOperationException ( "Project file is empty" ) ;
566564
567- project . Root ? . Add ( new XElement ( "PropertyGroup" , new XElement ( "EnableSDKContainerSupport" , "true" ) ) ) ;
568565 project . Save ( projectPath ) ;
569566 }
570567
@@ -575,7 +572,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
575572 CommandResult commandResult = new DotnetCommand (
576573 _testOutput ,
577574 "publish" ,
578- "/p:PublishProfile=DefaultContainer " ,
575+ "/t:PublishContainer " ,
579576 "/p:RuntimeIdentifier=linux-x64" ,
580577 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
581578 $ "/p:ContainerRegistry={ DockerRegistryManager . LocalRegistry } ",
@@ -604,21 +601,21 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
604601 var containerName = $ "test-container-1-{ projectType } -{ addPackageReference } ";
605602 CommandResult processResult = ContainerCli . RunCommand (
606603 _testOutput ,
607- "--rm" ,
608- "--name" ,
609- containerName ,
610- "-P" ,
611- "--detach" ,
612- $ "{ DockerRegistryManager . LocalRegistry } /{ imageName } :{ imageTag } ")
604+ [
605+ "--rm" ,
606+ "--name" ,
607+ containerName ,
608+ "-P" ,
609+ ..projectType != "console" ? [ "--detach" ] : new string [ ] { } ,
610+ $ "{ DockerRegistryManager . LocalRegistry } /{ imageName } :{ imageTag } "
611+ ] )
613612 . Execute ( ) ;
614613 processResult . Should ( ) . Pass ( ) ;
615614 Assert . NotNull ( processResult . StdOut ) ;
616615 string appContainerId = processResult . StdOut . Trim ( ) ;
617616
618617 bool everSucceeded = false ;
619618
620-
621-
622619 if ( projectType == "webapi" )
623620 {
624621 var portCommand =
@@ -657,14 +654,13 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
657654 Assert . True ( everSucceeded , $ "{ appUri } weatherforecast never responded.") ;
658655
659656 ContainerCli . StopCommand ( _testOutput , appContainerId )
660- . Execute ( )
661- . Should ( ) . Pass ( ) ;
657+ . Execute ( )
658+ . Should ( ) . Pass ( ) ;
662659 }
663660 else if ( projectType == "worker" )
664661 {
665662 // the worker template needs a second to start up and emit the logs we are looking for
666663 await Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) . ConfigureAwait ( false ) ;
667- var containerLogs =
668664 ContainerCli . LogsCommand ( _testOutput , appContainerId )
669665 . Execute ( )
670666 . Should ( ) . Pass ( )
@@ -673,10 +669,11 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
673669 ContainerCli . StopCommand ( _testOutput , appContainerId )
674670 . Execute ( )
675671 . Should ( ) . Pass ( ) ;
672+
676673 }
677- else
674+ else if ( projectType == "console" )
678675 {
679- throw new NotImplementedException ( "Unknown project type ") ;
676+ processResult . Should ( ) . Pass ( ) . And . HaveStdOutContaining ( "Hello, World! ") ;
680677 }
681678
682679 newProjectDir . Delete ( true ) ;
@@ -741,8 +738,7 @@ public void EndToEnd_NoAPI_Console(string baseImage)
741738 $ "/p:ContainerBaseImage={ baseImage } ",
742739 $ "/p:ContainerRegistry={ DockerRegistryManager . LocalRegistry } ",
743740 $ "/p:ContainerRepository={ imageName } ",
744- $ "/p:ContainerImageTag={ imageTag } ",
745- "/p:EnableSdkContainerSupport=true" )
741+ $ "/p:ContainerImageTag={ imageTag } ")
746742 . WithEnvironmentVariable ( "NUGET_PACKAGES" , privateNuGetAssets . FullName )
747743 . WithWorkingDirectory ( newProjectDir . FullName )
748744 . Execute ( )
@@ -782,8 +778,7 @@ public void EndToEnd_SingleArch_NoRid()
782778 "/t:PublishContainer" ,
783779 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
784780 $ "/p:ContainerRepository={ imageName } ",
785- $ "/p:ContainerImageTag={ imageTag } ",
786- "/p:EnableSdkContainerSupport=true" )
781+ $ "/p:ContainerImageTag={ imageTag } ")
787782 . WithWorkingDirectory ( newProjectDir . FullName )
788783 . Execute ( ) ;
789784 commandResult . Should ( ) . Pass ( ) ;
@@ -818,8 +813,7 @@ public void EndToEndMultiArch_LocalRegistry(string imageName)
818813 "/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
819814 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
820815 $ "/p:ContainerRepository={ imageName } ",
821- $ "/p:ContainerImageTag={ tag } ",
822- "/p:EnableSdkContainerSupport=true" )
816+ $ "/p:ContainerImageTag={ tag } ")
823817 . WithWorkingDirectory ( newProjectDir . FullName )
824818 . Execute ( ) ;
825819
@@ -882,7 +876,6 @@ public void MultiArchStillAllowsSingleRID()
882876 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
883877 $ "/p:ContainerRepository={ imageName } ",
884878 $ "/p:ContainerImageTag={ imageTag } ",
885- "/p:EnableSdkContainerSupport=true" ,
886879 "/bl" )
887880 . WithWorkingDirectory ( newProjectDir . FullName )
888881 . Execute ( ) ;
@@ -932,7 +925,6 @@ public void MultiArchStillAllowsSingleRIDUsingJustRIDProperties()
932925 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
933926 $ "/p:ContainerRepository={ imageName } ",
934927 $ "/p:ContainerImageTag={ imageTag } ",
935- "/p:EnableSdkContainerSupport=true" ,
936928 "/bl" )
937929 . WithWorkingDirectory ( newProjectDir . FullName )
938930 . Execute ( ) ;
@@ -1005,8 +997,7 @@ public void EndToEndMultiArch_ArchivePublishing(string imageName)
1005997 $ "/p:ContainerArchiveOutputPath={ archiveOutput } ",
1006998 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1007999 $ "/p:ContainerRepository={ imageName } ",
1008- $ "/p:ContainerImageTag={ tag } ",
1009- "/p:EnableSdkContainerSupport=true" )
1000+ $ "/p:ContainerImageTag={ tag } ")
10101001 . WithWorkingDirectory ( newProjectDir . FullName )
10111002 . Execute ( ) ;
10121003
@@ -1076,8 +1067,7 @@ public void EndToEndMultiArch_RemoteRegistry()
10761067 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
10771068 $ "/p:ContainerRegistry={ registry } ",
10781069 $ "/p:ContainerRepository={ imageName } ",
1079- $ "/p:ContainerImageTag={ imageTag } ",
1080- "/p:EnableSdkContainerSupport=true" )
1070+ $ "/p:ContainerImageTag={ imageTag } ")
10811071 . WithWorkingDirectory ( newProjectDir . FullName )
10821072 . Execute ( ) ;
10831073
@@ -1150,8 +1140,7 @@ public void EndToEndMultiArch_ContainerRuntimeIdentifiersOverridesRuntimeIdentif
11501140 "/p:ContainerRuntimeIdentifiers=linux-arm64" ,
11511141 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
11521142 $ "/p:ContainerRepository={ imageName } ",
1153- $ "/p:ContainerImageTag={ imageTag } ",
1154- "/p:EnableSdkContainerSupport=true" )
1143+ $ "/p:ContainerImageTag={ imageTag } ")
11551144 . WithWorkingDirectory ( newProjectDir . FullName )
11561145 . Execute ( ) ;
11571146
@@ -1201,8 +1190,7 @@ public void EndToEndMultiArch_EnvVariables()
12011190 "/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
12021191 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
12031192 $ "/p:ContainerRepository={ imageName } ",
1204- $ "/p:ContainerImageTag={ tag } ",
1205- "/p:EnableSdkContainerSupport=true" )
1193+ $ "/p:ContainerImageTag={ tag } ")
12061194 . WithWorkingDirectory ( newProjectDir . FullName )
12071195 . Execute ( )
12081196 . Should ( ) . Pass ( ) ;
@@ -1266,8 +1254,7 @@ public void EndToEndMultiArch_Ports()
12661254 "/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
12671255 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
12681256 $ "/p:ContainerRepository={ imageName } ",
1269- $ "/p:ContainerImageTag={ tag } ",
1270- "/p:EnableSdkContainerSupport=true" )
1257+ $ "/p:ContainerImageTag={ tag } ")
12711258 . WithWorkingDirectory ( newProjectDir . FullName )
12721259 . Execute ( )
12731260 . Should ( ) . Pass ( ) ;
@@ -1353,8 +1340,7 @@ public void EndToEndMultiArch_Labels()
13531340 "/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
13541341 $ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
13551342 $ "/p:ContainerRepository={ imageName } ",
1356- $ "/p:ContainerImageTag={ tag } ",
1357- "/p:EnableSdkContainerSupport=true" )
1343+ $ "/p:ContainerImageTag={ tag } ")
13581344 . WithWorkingDirectory ( newProjectDir . FullName )
13591345 . Execute ( )
13601346 . Should ( ) . Pass ( ) ;
0 commit comments