@@ -391,14 +391,10 @@ public async Task EndToEnd_MultiProjectSolution()
391
391
. Execute ( )
392
392
. Should ( ) . Pass ( ) ;
393
393
394
- // Add 'EnableSdkContainerSupport' property to the ConsoleApp and set TFM
394
+ // set TFM for the console app
395
395
using ( FileStream stream = File . Open ( Path . Join ( newSolutionDir . FullName , "ConsoleApp" , "ConsoleApp.csproj" ) , FileMode . Open , FileAccess . ReadWrite ) )
396
396
{
397
397
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" ) ) ;
402
398
document
403
399
. Descendants ( )
404
400
. First ( e => e . Name . LocalName == "TargetFramework" )
@@ -512,6 +508,8 @@ public async Task EndToEnd_MultiProjectSolution_with_multitargeted_library()
512
508
[ InlineData ( "webapi" , true ) ]
513
509
[ InlineData ( "worker" , false ) ]
514
510
[ InlineData ( "worker" , true ) ]
511
+ [ InlineData ( "console" , true ) ]
512
+ [ InlineData ( "console" , false ) ]
515
513
public async Task EndToEnd_NoAPI_ProjectType ( string projectType , bool addPackageReference )
516
514
{
517
515
DirectoryInfo newProjectDir = new ( Path . Combine ( TestSettings . TestArtifactsDirectory , $ "CreateNewImageTest_{ projectType } _{ addPackageReference } ") ) ;
@@ -564,7 +562,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
564
562
var project = XDocument . Load ( projectPath ) ;
565
563
var ns = project . Root ? . Name . Namespace ?? throw new InvalidOperationException ( "Project file is empty" ) ;
566
564
567
- project . Root ? . Add ( new XElement ( "PropertyGroup" , new XElement ( "EnableSDKContainerSupport" , "true" ) ) ) ;
568
565
project . Save ( projectPath ) ;
569
566
}
570
567
@@ -575,7 +572,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
575
572
CommandResult commandResult = new DotnetCommand (
576
573
_testOutput ,
577
574
"publish" ,
578
- "/p:PublishProfile=DefaultContainer " ,
575
+ "/t:PublishContainer " ,
579
576
"/p:RuntimeIdentifier=linux-x64" ,
580
577
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
581
578
$ "/p:ContainerRegistry={ DockerRegistryManager . LocalRegistry } ",
@@ -604,21 +601,21 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
604
601
var containerName = $ "test-container-1-{ projectType } -{ addPackageReference } ";
605
602
CommandResult processResult = ContainerCli . RunCommand (
606
603
_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
+ ] )
613
612
. Execute ( ) ;
614
613
processResult . Should ( ) . Pass ( ) ;
615
614
Assert . NotNull ( processResult . StdOut ) ;
616
615
string appContainerId = processResult . StdOut . Trim ( ) ;
617
616
618
617
bool everSucceeded = false ;
619
618
620
-
621
-
622
619
if ( projectType == "webapi" )
623
620
{
624
621
var portCommand =
@@ -657,14 +654,13 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
657
654
Assert . True ( everSucceeded , $ "{ appUri } weatherforecast never responded.") ;
658
655
659
656
ContainerCli . StopCommand ( _testOutput , appContainerId )
660
- . Execute ( )
661
- . Should ( ) . Pass ( ) ;
657
+ . Execute ( )
658
+ . Should ( ) . Pass ( ) ;
662
659
}
663
660
else if ( projectType == "worker" )
664
661
{
665
662
// the worker template needs a second to start up and emit the logs we are looking for
666
663
await Task . Delay ( TimeSpan . FromSeconds ( 5 ) ) . ConfigureAwait ( false ) ;
667
- var containerLogs =
668
664
ContainerCli . LogsCommand ( _testOutput , appContainerId )
669
665
. Execute ( )
670
666
. Should ( ) . Pass ( )
@@ -673,10 +669,11 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
673
669
ContainerCli . StopCommand ( _testOutput , appContainerId )
674
670
. Execute ( )
675
671
. Should ( ) . Pass ( ) ;
672
+
676
673
}
677
- else
674
+ else if ( projectType == "console" )
678
675
{
679
- throw new NotImplementedException ( "Unknown project type ") ;
676
+ processResult . Should ( ) . Pass ( ) . And . HaveStdOutContaining ( "Hello, World! ") ;
680
677
}
681
678
682
679
newProjectDir . Delete ( true ) ;
@@ -741,8 +738,7 @@ public void EndToEnd_NoAPI_Console(string baseImage)
741
738
$ "/p:ContainerBaseImage={ baseImage } ",
742
739
$ "/p:ContainerRegistry={ DockerRegistryManager . LocalRegistry } ",
743
740
$ "/p:ContainerRepository={ imageName } ",
744
- $ "/p:ContainerImageTag={ imageTag } ",
745
- "/p:EnableSdkContainerSupport=true" )
741
+ $ "/p:ContainerImageTag={ imageTag } ")
746
742
. WithEnvironmentVariable ( "NUGET_PACKAGES" , privateNuGetAssets . FullName )
747
743
. WithWorkingDirectory ( newProjectDir . FullName )
748
744
. Execute ( )
@@ -782,8 +778,7 @@ public void EndToEnd_SingleArch_NoRid()
782
778
"/t:PublishContainer" ,
783
779
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
784
780
$ "/p:ContainerRepository={ imageName } ",
785
- $ "/p:ContainerImageTag={ imageTag } ",
786
- "/p:EnableSdkContainerSupport=true" )
781
+ $ "/p:ContainerImageTag={ imageTag } ")
787
782
. WithWorkingDirectory ( newProjectDir . FullName )
788
783
. Execute ( ) ;
789
784
commandResult . Should ( ) . Pass ( ) ;
@@ -818,8 +813,7 @@ public void EndToEndMultiArch_LocalRegistry(string imageName)
818
813
"/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
819
814
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
820
815
$ "/p:ContainerRepository={ imageName } ",
821
- $ "/p:ContainerImageTag={ tag } ",
822
- "/p:EnableSdkContainerSupport=true" )
816
+ $ "/p:ContainerImageTag={ tag } ")
823
817
. WithWorkingDirectory ( newProjectDir . FullName )
824
818
. Execute ( ) ;
825
819
@@ -882,7 +876,6 @@ public void MultiArchStillAllowsSingleRID()
882
876
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
883
877
$ "/p:ContainerRepository={ imageName } ",
884
878
$ "/p:ContainerImageTag={ imageTag } ",
885
- "/p:EnableSdkContainerSupport=true" ,
886
879
"/bl" )
887
880
. WithWorkingDirectory ( newProjectDir . FullName )
888
881
. Execute ( ) ;
@@ -932,7 +925,6 @@ public void MultiArchStillAllowsSingleRIDUsingJustRIDProperties()
932
925
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
933
926
$ "/p:ContainerRepository={ imageName } ",
934
927
$ "/p:ContainerImageTag={ imageTag } ",
935
- "/p:EnableSdkContainerSupport=true" ,
936
928
"/bl" )
937
929
. WithWorkingDirectory ( newProjectDir . FullName )
938
930
. Execute ( ) ;
@@ -1005,8 +997,7 @@ public void EndToEndMultiArch_ArchivePublishing(string imageName)
1005
997
$ "/p:ContainerArchiveOutputPath={ archiveOutput } ",
1006
998
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1007
999
$ "/p:ContainerRepository={ imageName } ",
1008
- $ "/p:ContainerImageTag={ tag } ",
1009
- "/p:EnableSdkContainerSupport=true" )
1000
+ $ "/p:ContainerImageTag={ tag } ")
1010
1001
. WithWorkingDirectory ( newProjectDir . FullName )
1011
1002
. Execute ( ) ;
1012
1003
@@ -1076,8 +1067,7 @@ public void EndToEndMultiArch_RemoteRegistry()
1076
1067
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1077
1068
$ "/p:ContainerRegistry={ registry } ",
1078
1069
$ "/p:ContainerRepository={ imageName } ",
1079
- $ "/p:ContainerImageTag={ imageTag } ",
1080
- "/p:EnableSdkContainerSupport=true" )
1070
+ $ "/p:ContainerImageTag={ imageTag } ")
1081
1071
. WithWorkingDirectory ( newProjectDir . FullName )
1082
1072
. Execute ( ) ;
1083
1073
@@ -1150,8 +1140,7 @@ public void EndToEndMultiArch_ContainerRuntimeIdentifiersOverridesRuntimeIdentif
1150
1140
"/p:ContainerRuntimeIdentifiers=linux-arm64" ,
1151
1141
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1152
1142
$ "/p:ContainerRepository={ imageName } ",
1153
- $ "/p:ContainerImageTag={ imageTag } ",
1154
- "/p:EnableSdkContainerSupport=true" )
1143
+ $ "/p:ContainerImageTag={ imageTag } ")
1155
1144
. WithWorkingDirectory ( newProjectDir . FullName )
1156
1145
. Execute ( ) ;
1157
1146
@@ -1201,8 +1190,7 @@ public void EndToEndMultiArch_EnvVariables()
1201
1190
"/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
1202
1191
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1203
1192
$ "/p:ContainerRepository={ imageName } ",
1204
- $ "/p:ContainerImageTag={ tag } ",
1205
- "/p:EnableSdkContainerSupport=true" )
1193
+ $ "/p:ContainerImageTag={ tag } ")
1206
1194
. WithWorkingDirectory ( newProjectDir . FullName )
1207
1195
. Execute ( )
1208
1196
. Should ( ) . Pass ( ) ;
@@ -1266,8 +1254,7 @@ public void EndToEndMultiArch_Ports()
1266
1254
"/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
1267
1255
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1268
1256
$ "/p:ContainerRepository={ imageName } ",
1269
- $ "/p:ContainerImageTag={ tag } ",
1270
- "/p:EnableSdkContainerSupport=true" )
1257
+ $ "/p:ContainerImageTag={ tag } ")
1271
1258
. WithWorkingDirectory ( newProjectDir . FullName )
1272
1259
. Execute ( )
1273
1260
. Should ( ) . Pass ( ) ;
@@ -1353,8 +1340,7 @@ public void EndToEndMultiArch_Labels()
1353
1340
"/p:RuntimeIdentifiers=\" linux-x64;linux-arm64\" " ,
1354
1341
$ "/p:ContainerBaseImage={ DockerRegistryManager . FullyQualifiedBaseImageAspNet } ",
1355
1342
$ "/p:ContainerRepository={ imageName } ",
1356
- $ "/p:ContainerImageTag={ tag } ",
1357
- "/p:EnableSdkContainerSupport=true" )
1343
+ $ "/p:ContainerImageTag={ tag } ")
1358
1344
. WithWorkingDirectory ( newProjectDir . FullName )
1359
1345
. Execute ( )
1360
1346
. Should ( ) . Pass ( ) ;
0 commit comments