Update LibraryExporterExtensions.cs
This commit is contained in:
parent
2aa07efa10
commit
f769f9ea1c
1 changed files with 68 additions and 52 deletions
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
@ -27,7 +28,21 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
|
|||
|
||||
foreach (var asset in assets)
|
||||
{
|
||||
File.Copy(asset.ResolvedPath, Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath)), overwrite: true);
|
||||
var file = Path.Combine(destinationPath, Path.GetFileName(asset.ResolvedPath));
|
||||
File.Copy(asset.ResolvedPath, file, overwrite: true);
|
||||
RemoveFileAttribute(file, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveFileAttribute(String file, FileAttributes attribute)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
var fileAttributes = File.GetAttributes(file);
|
||||
if ((fileAttributes & attribute) == attribute)
|
||||
{
|
||||
File.SetAttributes(file, fileAttributes & ~attribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +59,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
|
|||
var transformedFile = asset.GetTransformedFile(tempLocation);
|
||||
|
||||
File.Copy(transformedFile, targetName, overwrite: true);
|
||||
RemoveFileAttribute(targetName, FileAttributes.ReadOnly);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue