File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
dotnet-new.IntegrationTests
dotnet.Tests/CommandTests/Tool/Install Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ public TemplateDiscoveryTool(IMessageSink messageSink)
1515 testOutputHelper = new SharedTestOutputHelper ( messageSink ) ;
1616 string home = Utilities . CreateTemporaryFolder ( "home" ) ;
1717 dotnetNewTestExecutionDir = Utilities . GetTestExecutionTempFolder ( ) ;
18- string toolManifestPath = Path . Combine ( dotnetNewTestExecutionDir , @".config\ dotnet-tools.json") ;
18+ string toolManifestPath = Path . Combine ( dotnetNewTestExecutionDir , " dotnet-tools.json") ;
1919 if ( ! File . Exists ( toolManifestPath ) )
2020 {
2121 new DotnetNewCommand (
Original file line number Diff line number Diff line change @@ -315,6 +315,26 @@ out ToolCommand restoredCommand
315315 "But restore do not need to 'revert' since it just set in nuget global directory" ) ;
316316 }
317317
318+ [ Fact ]
319+ public void WhenRunWithExistingManifestInConfigDirectoryItShouldAddToExistingManifest ( )
320+ {
321+ // Test backward compatibility: ensure tools can be added to existing manifests in .config directories
322+ _fileSystem . File . Delete ( _manifestFilePath ) ;
323+ var configDirectory = Path . Combine ( _temporaryDirectory , ".config" ) ;
324+ _fileSystem . Directory . CreateDirectory ( configDirectory ) ;
325+ var configManifestPath = Path . Combine ( configDirectory , "dotnet-tools.json" ) ;
326+ _fileSystem . File . WriteAllText ( configManifestPath , _jsonContent ) ;
327+
328+ var toolInstallLocalCommand = GetDefaultTestToolInstallLocalCommand ( ) ;
329+
330+ toolInstallLocalCommand . Execute ( ) . Should ( ) . Be ( 0 ) ;
331+
332+ // Verify the tool was added to the existing .config manifest
333+ var manifestPackages = _toolManifestFinder . Find ( ) ;
334+ manifestPackages . Should ( ) . HaveCount ( 1 ) ;
335+ manifestPackages . First ( ) . PackageId . Should ( ) . Be ( _packageIdA ) ;
336+ }
337+
318338 private ToolInstallLocalCommand GetDefaultTestToolInstallLocalCommand ( )
319339 {
320340 return new ToolInstallLocalCommand (
You can’t perform that action at this time.
0 commit comments