@@ -720,5 +720,50 @@ public void It_builds_with_unicode_characters_in_path()
720720 . Should ( )
721721 . Pass ( ) ;
722722 }
723+
724+ [ Fact ]
725+ public void It_regenerates_files_if_self_contained_changes ( )
726+ {
727+ const string TFM = "netcoreapp3.0" ;
728+
729+ var runtimeIdentifier = EnvironmentInfo . GetCompatibleRid ( TFM ) ;
730+
731+ var testProject = new TestProject ( )
732+ {
733+ Name = "GenerateFilesTest" ,
734+ TargetFrameworks = TFM ,
735+ RuntimeIdentifier = runtimeIdentifier ,
736+ IsSdkProject = true ,
737+ IsExe = true
738+ } ;
739+
740+ var testAsset = _testAssetsManager
741+ . CreateTestProject ( testProject )
742+ . Restore ( Log , testProject . Name ) ;
743+
744+ var buildCommand = new BuildCommand ( Log , Path . Combine ( testAsset . TestRoot , testProject . Name ) ) ;
745+
746+ buildCommand
747+ . Execute ( )
748+ . Should ( )
749+ . Pass ( ) ;
750+
751+ var outputPath = buildCommand . GetOutputDirectory ( targetFramework : TFM , runtimeIdentifier : runtimeIdentifier ) . FullName ;
752+ var depsFilePath = Path . Combine ( outputPath , $ "{ testProject . Name } .deps.json") ;
753+ var runtimeConfigPath = Path . Combine ( outputPath , $ "{ testProject . Name } .runtimeconfig.json") ;
754+
755+ var depsFileLastWriteTime = File . GetLastWriteTimeUtc ( depsFilePath ) ;
756+ var runtimeConfigLastWriteTime = File . GetLastWriteTimeUtc ( runtimeConfigPath ) ;
757+
758+ WaitForUtcNowToAdvance ( ) ;
759+
760+ buildCommand
761+ . Execute ( "/p:SelfContained=false" )
762+ . Should ( )
763+ . Pass ( ) ;
764+
765+ depsFileLastWriteTime . Should ( ) . NotBe ( File . GetLastWriteTimeUtc ( depsFilePath ) ) ;
766+ runtimeConfigLastWriteTime . Should ( ) . NotBe ( File . GetLastWriteTimeUtc ( runtimeConfigPath ) ) ;
767+ }
723768 }
724769}
0 commit comments