diff --git a/build/Microsoft.DotNet.Cli.Publish.targets b/build/Microsoft.DotNet.Cli.Publish.targets
index 7a43b3008..5eb6b1dec 100644
--- a/build/Microsoft.DotNet.Cli.Publish.targets
+++ b/build/Microsoft.DotNet.Cli.Publish.targets
@@ -5,6 +5,7 @@
+
+
+
\ No newline at end of file
diff --git a/build_projects/dotnet-cli-build/FinalizeBuildTask.cs b/build_projects/dotnet-cli-build/FinalizeBuildTask.cs
index 2e8d2901a..cba8c45a7 100644
--- a/build_projects/dotnet-cli-build/FinalizeBuildTask.cs
+++ b/build_projects/dotnet-cli-build/FinalizeBuildTask.cs
@@ -30,7 +30,8 @@ namespace Microsoft.DotNet.Cli.Build
[Required]
public string BranchName { get; set; }
- private AzurePublisher AzurePublisherTool {
+ private AzurePublisher AzurePublisherTool
+ {
get
{
if(_azurePublisher == null)
diff --git a/build_projects/dotnet-cli-build/SetBlobPropertiesBasedOnFileTypeTask.cs b/build_projects/dotnet-cli-build/SetBlobPropertiesBasedOnFileTypeTask.cs
new file mode 100644
index 000000000..b1ed15877
--- /dev/null
+++ b/build_projects/dotnet-cli-build/SetBlobPropertiesBasedOnFileTypeTask.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace Microsoft.DotNet.Cli.Build
+{
+ public class SetBlobPropertiesBasedOnFileTypeTask : Task
+ {
+ private AzurePublisher _azurePublisher;
+
+ [Required]
+ public string AccountName { get; set; }
+
+ [Required]
+ public string AccountKey { get; set; }
+
+ [Required]
+ public ITaskItem[] Items { get; set; }
+
+ private AzurePublisher AzurePublisherTool
+ {
+ get
+ {
+ if(_azurePublisher == null)
+ {
+ _azurePublisher = new AzurePublisher(AccountName, AccountKey);
+ }
+
+ return _azurePublisher;
+ }
+ }
+
+ public override bool Execute()
+ {
+ if (Items.Length == 0)
+ {
+ Log.LogError("No items were provided for upload.");
+ return false;
+ }
+
+ foreach(var item in Items)
+ {
+ string relativeBlobPath = item.GetMetadata("RelativeBlobPath");
+ if (string.IsNullOrEmpty(relativeBlobPath))
+ {
+ throw new Exception(string.Format(
+ "Metadata 'RelativeBlobPath' is missing for item '{0}'.",
+ item.ItemSpec));
+ }
+
+ AzurePublisherTool.SetBlobPropertiesBasedOnFileType(relativeBlobPath);
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs
index 28e1b5bc8..922fb7753 100644
--- a/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs
+++ b/build_projects/shared-build-targets-utils/Publishing/AzurePublisher.cs
@@ -92,6 +92,12 @@ namespace Microsoft.DotNet.Cli.Build
target.StartCopyAsync(source).Wait();
}
+ public void SetBlobPropertiesBasedOnFileType(string path)
+ {
+ CloudBlockBlob blob = _blobContainer.GetBlockBlobReference(path);
+ SetBlobPropertiesBasedOnFileType(blob);
+ }
+
private void SetBlobPropertiesBasedOnFileType(CloudBlockBlob blockBlob)
{
if (Path.GetExtension(blockBlob.Uri.AbsolutePath.ToLower()) == ".svg")