Download and extract shared framework 1.1. This initial change gets 1.1 into the archive installers. Still need to bring it into the native installers as well.
This commit is contained in:
parent
75786cd59a
commit
e5e11c19c2
3 changed files with 96 additions and 18 deletions
|
@ -42,12 +42,6 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
Log.LogMessage(MessageImportance.Low, "'{0}' already exists, trying to delete before unzipping...", DestinationDirectory);
|
||||
Directory.Delete(DestinationDirectory, recursive: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogWarning("'{0}' already exists. Did you forget to set '{1}' to true?", DestinationDirectory, nameof(OverwriteDestination));
|
||||
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!File.Exists(SourceArchive))
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
public string DestinationDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the destination archive should be overwritten if it already exists.
|
||||
/// Indicates if the destination directory should be cleaned if it already exists.
|
||||
/// </summary>
|
||||
public bool OverwriteDestination { get; set; }
|
||||
|
||||
|
@ -40,17 +40,37 @@ namespace Microsoft.DotNet.Build.Tasks
|
|||
Log.LogMessage(MessageImportance.Low, "'{0}' already exists, trying to delete before unzipping...", DestinationDirectory);
|
||||
Directory.Delete(DestinationDirectory, recursive: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogWarning("'{0}' already exists. Did you forget to set '{1}' to true?", DestinationDirectory, nameof(OverwriteDestination));
|
||||
}
|
||||
}
|
||||
|
||||
Log.LogMessage(MessageImportance.High, "Decompressing '{0}' into '{1}'...", SourceArchive, DestinationDirectory);
|
||||
if (!Directory.Exists(Path.GetDirectoryName(DestinationDirectory)))
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(DestinationDirectory));
|
||||
|
||||
ZipFile.ExtractToDirectory(SourceArchive, DestinationDirectory);
|
||||
// match tar default behavior to overwrite by default
|
||||
// Replace this code with ZipFile.ExtractToDirectory when https://github.com/dotnet/corefx/pull/14806 is available
|
||||
using (ZipArchive archive = ZipFile.Open(SourceArchive, ZipArchiveMode.Read))
|
||||
{
|
||||
DirectoryInfo di = Directory.CreateDirectory(DestinationDirectory);
|
||||
string destinationDirectoryFullPath = di.FullName;
|
||||
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
string fileDestinationPath = Path.GetFullPath(Path.Combine(destinationDirectoryFullPath, entry.FullName));
|
||||
|
||||
if (Path.GetFileName(fileDestinationPath).Length == 0)
|
||||
{
|
||||
// If it is a directory:
|
||||
Directory.CreateDirectory(fileDestinationPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If it is a file:
|
||||
// Create containing directory:
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fileDestinationPath));
|
||||
entry.ExtractToFile(fileDestinationPath, overwrite: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue