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)
15
15
testOutputHelper = new SharedTestOutputHelper ( messageSink ) ;
16
16
string home = Utilities . CreateTemporaryFolder ( "home" ) ;
17
17
dotnetNewTestExecutionDir = Utilities . GetTestExecutionTempFolder ( ) ;
18
- string toolManifestPath = Path . Combine ( dotnetNewTestExecutionDir , @".config\ dotnet-tools.json") ;
18
+ string toolManifestPath = Path . Combine ( dotnetNewTestExecutionDir , " dotnet-tools.json") ;
19
19
if ( ! File . Exists ( toolManifestPath ) )
20
20
{
21
21
new DotnetNewCommand (
Original file line number Diff line number Diff line change @@ -315,6 +315,26 @@ out ToolCommand restoredCommand
315
315
"But restore do not need to 'revert' since it just set in nuget global directory" ) ;
316
316
}
317
317
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
+
318
338
private ToolInstallLocalCommand GetDefaultTestToolInstallLocalCommand ( )
319
339
{
320
340
return new ToolInstallLocalCommand (
You can’t perform that action at this time.
0 commit comments