File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -255,12 +255,24 @@ public void Dispose()
255
255
256
256
try
257
257
{
258
- File . Delete ( nugetConfigPath ) ;
258
+ if ( backupNugetConfig is null )
259
+ {
260
+ logger . LogInfo ( "Removing nuget.config file" ) ;
261
+ File . Delete ( nugetConfigPath ) ;
262
+ return ;
263
+ }
259
264
260
- if ( backupNugetConfig is not null )
265
+ logger . LogInfo ( "Reverting nuget.config file content" ) ;
266
+ // The content of the original nuget.config file is reverted without changing the file's attributes or casing:
267
+ using ( var backup = File . OpenRead ( backupNugetConfig ) )
268
+ using ( var current = File . OpenWrite ( nugetConfigPath ) )
261
269
{
262
- File . Move ( backupNugetConfig , nugetConfigPath ) ;
270
+ current . SetLength ( 0 ) ;
271
+ backup . CopyTo ( current ) ;
263
272
}
273
+
274
+ logger . LogInfo ( "Deleting backup nuget.config file" ) ;
275
+ File . Delete ( backupNugetConfig ) ;
264
276
}
265
277
catch ( Exception exc )
266
278
{
You can’t perform that action at this time.
0 commit comments