Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ public class RemoveRuntimeDependencies : Task
[Required]
public string OutputPath { get; set; }

[Required]
public ITaskItem[] IgnoreFiles { get; set; }

public override bool Execute()
{
HashSet<string> ignoreFilesSet = new HashSet<string>();
foreach (ITaskItem item in IgnoreFiles)
{
ignoreFilesSet.Add(item.ItemSpec);
}

Assembly assembly = typeof(RemoveRuntimeDependencies).Assembly;
using (Stream resource = assembly.GetManifestResourceStream(assembly.GetName().Name + ".runtimeassemblies.txt"))
using (var reader = new StreamReader(resource))
Expand All @@ -32,7 +41,7 @@ public override bool Execute()
{
string fileName = Path.Combine(OutputPath, assemblyName);

if (File.Exists(fileName))
if (File.Exists(fileName) && !ignoreFilesSet.Contains(assemblyName))
{
File.Delete(fileName);
}
Expand All @@ -44,4 +53,4 @@ public override bool Execute()
return true;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
AssemblyFile="$(_FunctionsExtensionsTaskAssemblyFullPath)"/>

<Target Name="_FunctionsBuildCleanOutput" AfterTargets="_GenerateFunctionsExtensionsMetadataPostBuild" Condition="$(_FunctionsSkipCleanOutput) != 'true'" >
<RemoveRuntimeDependencies OutputPath="$(TargetDir)bin"/>
<RemoveRuntimeDependencies OutputPath="$(TargetDir)bin" IgnoreFiles="@(FunctionsPreservedDependencies)"/>
</Target>

<Target Name="_FunctionsPublishCleanOutput" AfterTargets="_GenerateFunctionsExtensionsMetadataPostPublish" Condition="$(_FunctionsSkipCleanOutput) != 'true'" >
<RemoveRuntimeDependencies OutputPath="$(PublishDir)bin"/>
<RemoveRuntimeDependencies OutputPath="$(PublishDir)bin" IgnoreFiles="@(FunctionsPreservedDependencies)"/>
</Target>

<UsingTask TaskName="GenerateFunctionsExtensionsMetadata"
Expand Down