@@ -38,7 +38,20 @@ public void Dispose()
3838 _loggerFactory . Dispose ( ) ;
3939 }
4040
41- [ DockerAvailableFact ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
41+ internal static readonly string _oldFramework = "net9.0" ;
42+ // CLI will not let us to target net9.0 anymore but we still need it because images for net10.0 aren't ready yet.
43+ // so we let it create net10.0 app, then change the target. Since we're building just small sample applications, it works.
44+ internal static void ChangeTargetFrameworkAfterAppCreation ( string path )
45+ {
46+ DirectoryInfo d = new DirectoryInfo ( path ) ;
47+ FileInfo [ ] Files = d . GetFiles ( "*.csproj" ) ; //Getting .csproj files
48+ string csprojFilename = Files [ 0 ] . Name ; // There is only one
49+ string text = File . ReadAllText ( Path . Combine ( path , csprojFilename ) ) ;
50+ text = text . Replace ( "net10.0" , _oldFramework ) ;
51+ File . WriteAllText ( Path . Combine ( path , csprojFilename ) , text ) ;
52+ }
53+
54+ [ DockerAvailableFact ]
4255 public async Task ApiEndToEndWithRegistryPushAndPull ( )
4356 {
4457 ILogger logger = _loggerFactory . CreateLogger ( nameof ( ApiEndToEndWithRegistryPushAndPull ) ) ;
@@ -85,7 +98,7 @@ public async Task ApiEndToEndWithRegistryPushAndPull()
8598 }
8699 }
87100
88- [ DockerAvailableFact ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
101+ [ DockerAvailableFact ]
89102 public async Task ApiEndToEndWithLocalLoad ( )
90103 {
91104 ILogger logger = _loggerFactory . CreateLogger ( nameof ( ApiEndToEndWithLocalLoad ) ) ;
@@ -126,7 +139,7 @@ public async Task ApiEndToEndWithLocalLoad()
126139 }
127140 }
128141
129- [ DockerAvailableFact ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
142+ [ DockerAvailableFact ]
130143 public async Task ApiEndToEndWithArchiveWritingAndLoad ( )
131144 {
132145 ILogger logger = _loggerFactory . CreateLogger ( nameof ( ApiEndToEndWithArchiveWritingAndLoad ) ) ;
@@ -193,8 +206,11 @@ private string BuildLocalApp([CallerMemberName] string testName = "TestName", st
193206 . Execute ( )
194207 . Should ( ) . Pass ( ) ;
195208
209+ ChangeTargetFrameworkAfterAppCreation ( Path . Combine ( TestSettings . TestArtifactsDirectory , testName , "MinimalTestApp" ) ) ;
210+
211+
196212 var publishCommand =
197- new DotnetCommand ( _testOutput , "publish" , "-bl" , "MinimalTestApp" , "-r" , rid , "-f" , tfm , "-c" , "Debug" )
213+ new DotnetCommand ( _testOutput , "publish" , "-bl" , "MinimalTestApp" , "-r" , rid , "-f" , _oldFramework , "-c" , "Debug" )
198214 . WithWorkingDirectory ( workingDirectory ) ;
199215
200216 if ( tfm == ToolsetInfo . CurrentTargetFramework )
@@ -205,11 +221,11 @@ private string BuildLocalApp([CallerMemberName] string testName = "TestName", st
205221 publishCommand . Execute ( )
206222 . Should ( ) . Pass ( ) ;
207223
208- string publishDirectory = Path . Join ( workingDirectory , "MinimalTestApp" , "bin" , "Debug" , tfm , rid , "publish" ) ;
224+ string publishDirectory = Path . Join ( workingDirectory , "MinimalTestApp" , "bin" , "Debug" , _oldFramework , rid , "publish" ) ;
209225 return publishDirectory ;
210226 }
211227
212- [ DockerAvailableFact ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
228+ [ DockerAvailableFact ]
213229 public async Task EndToEnd_MultiProjectSolution ( )
214230 {
215231 ILogger logger = _loggerFactory . CreateLogger ( nameof ( EndToEnd_MultiProjectSolution ) ) ;
@@ -262,7 +278,7 @@ public async Task EndToEnd_MultiProjectSolution()
262278 document
263279 . Descendants ( )
264280 . First ( e => e . Name . LocalName == "TargetFramework" )
265- . Value = ToolsetInfo . CurrentTargetFramework ;
281+ . Value = _oldFramework ;
266282
267283 stream . SetLength ( 0 ) ;
268284 await document . SaveAsync ( stream , SaveOptions . None , CancellationToken . None ) ;
@@ -275,7 +291,7 @@ public async Task EndToEnd_MultiProjectSolution()
275291 document
276292 . Descendants ( )
277293 . First ( e => e . Name . LocalName == "TargetFramework" )
278- . Value = ToolsetInfo . CurrentTargetFramework ;
294+ . Value = _oldFramework ;
279295
280296 stream . SetLength ( 0 ) ;
281297 await document . SaveAsync ( stream , SaveOptions . None , CancellationToken . None ) ;
@@ -291,7 +307,7 @@ public async Task EndToEnd_MultiProjectSolution()
291307 commandResult . Should ( ) . HaveStdOutContaining ( "Pushed image 'consoleapp:latest'" ) ;
292308 }
293309
294- [ DockerAvailableTheory ( Skip = "https://github.com/dotnet/sdk/issues/42850 " ) ]
310+ [ DockerAvailableTheory ( Skip = "https://github.com/dotnet/sdk/issues/45181 " ) ]
295311 [ InlineData ( "webapi" , false ) ]
296312 [ InlineData ( "webapi" , true ) ]
297313 [ InlineData ( "worker" , false ) ]
@@ -313,7 +329,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
313329
314330 newProjectDir . Create ( ) ;
315331 privateNuGetAssets . Create ( ) ;
316-
317332 new DotnetNewCommand ( _testOutput , projectType , "-f" , ToolsetInfo . CurrentTargetFramework )
318333 . WithVirtualHive ( )
319334 . WithWorkingDirectory ( newProjectDir . FullName )
@@ -399,7 +414,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
399414 processResult . Should ( ) . Pass ( ) ;
400415 Assert . NotNull ( processResult . StdOut ) ;
401416 string appContainerId = processResult . StdOut . Trim ( ) ;
402-
403417 bool everSucceeded = false ;
404418
405419
@@ -468,7 +482,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage
468482 privateNuGetAssets . Delete ( true ) ;
469483 }
470484
471- [ DockerAvailableFact ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
485+ [ DockerAvailableFact ]
472486 public void EndToEnd_NoAPI_Console ( )
473487 {
474488 DirectoryInfo newProjectDir = new ( Path . Combine ( TestSettings . TestArtifactsDirectory , "CreateNewImageTest" ) ) ;
@@ -494,6 +508,7 @@ public void EndToEnd_NoAPI_Console()
494508 . WithEnvironmentVariable ( "NUGET_PACKAGES" , privateNuGetAssets . FullName )
495509 . Execute ( )
496510 . Should ( ) . Pass ( ) ;
511+ ChangeTargetFrameworkAfterAppCreation ( newProjectDir . FullName ) ;
497512
498513 File . Copy ( Path . Combine ( TestContext . Current . TestExecutionDirectory , "NuGet.config" ) , Path . Combine ( newProjectDir . FullName , "NuGet.config" ) ) ;
499514
@@ -506,7 +521,7 @@ public void EndToEnd_NoAPI_Console()
506521 . Should ( ) . Pass ( ) ;
507522
508523 // Add package to the project
509- new DotnetCommand ( _testOutput , "add" , "package" , "Microsoft.NET.Build.Containers" , "-f" , ToolsetInfo . CurrentTargetFramework , "-v" , packageVersion )
524+ new DotnetCommand ( _testOutput , "add" , "package" , "Microsoft.NET.Build.Containers" , "-f" , _oldFramework , "-v" , packageVersion )
510525 . WithEnvironmentVariable ( "NUGET_PACKAGES" , privateNuGetAssets . FullName )
511526 . WithWorkingDirectory ( newProjectDir . FullName )
512527 . Execute ( )
@@ -555,7 +570,7 @@ public void EndToEnd_NoAPI_Console()
555570 [ DockerSupportsArchInlineData ( "linux/386" , "linux-x86" , "/app" , Skip = "There's no apphost for linux-x86 so we can't execute self-contained, and there's no .NET runtime base image for linux-x86 so we can't execute framework-dependent." ) ]
556571 [ DockerSupportsArchInlineData ( "windows/amd64" , "win-x64" , "C:\\ app" ) ]
557572 [ DockerSupportsArchInlineData ( "linux/amd64" , "linux-x64" , "/app" ) ]
558- [ DockerAvailableTheory ( Skip = "https://github.com/dotnet/sdk/issues/42850" ) ]
573+ [ DockerAvailableTheory ]
559574 public async Task CanPackageForAllSupportedContainerRIDs ( string dockerPlatform , string rid , string workingDir )
560575 {
561576 ILogger logger = _loggerFactory . CreateLogger ( nameof ( CanPackageForAllSupportedContainerRIDs ) ) ;
0 commit comments