From 15ec157999c9ab0605fff4f394a6bd62c2e7e058 Mon Sep 17 00:00:00 2001
From: Ankit Kumar <ankikuma@microsoft.com>
Date: Fri, 16 Aug 2019 11:54:17 -0700
Subject: [PATCH 1/3] Azure Functions Host v2.0.12641 release

---
 src/Azure.Functions.Cli/Azure.Functions.Cli.csproj | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj b/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
index b91b96163..a2fc1fb98 100644
--- a/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
+++ b/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
@@ -109,8 +109,8 @@
     <PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage.Internal" Version="1.4.0" />
     <PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="1.5.10246" />
     <PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="1.0.3" />
-    <PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker" Version="0.1.120-preview" />
-    <PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="2.0.12625" />
+    <PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker" Version="0.1.152-preview" />
+    <PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="2.0.12641" />
     <PackageReference Include="Microsoft.Azure.Functions.PythonWorkerRunEnvironments" Version="1.0.0-beta20190801.11" />
     <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
     <PackageReference Include="YamlDotNet" Version="6.0.0" />

From c8c912d92ca5bcd8df53bb33e9acdb2fbd327684 Mon Sep 17 00:00:00 2001
From: guojian83 <guojian83@yahoo.com>
Date: Sat, 17 Aug 2019 09:05:33 +1000
Subject: [PATCH 2/3] Support csx mode in docker (#1488)

* Support csharp script (csx) with proper docker file.

* Added unit tests. Use csx flag in the init command.
---
 .../Actions/LocalActions/InitAction.cs        | 15 +++++--
 .../Azure.Functions.Cli.csproj                |  3 ++
 .../StaticResources/Dockerfile.csx.dotnet     |  5 +++
 .../StaticResources/StaticResources.cs        |  2 +
 .../E2E/InitTests.cs                          | 42 +++++++++++++++++++
 5 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100644 src/Azure.Functions.Cli/StaticResources/Dockerfile.csx.dotnet

diff --git a/src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs b/src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs
index 42b8dc1c0..2f5e38be5 100644
--- a/src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs
+++ b/src/Azure.Functions.Cli/Actions/LocalActions/InitAction.cs
@@ -144,7 +144,7 @@ public override async Task RunAsync()
 
         private async Task InitDockerFileOnly()
         {
-            await WriteDockerfile(GlobalCoreToolsSettings.CurrentWorkerRuntime);
+            await WriteDockerfile(GlobalCoreToolsSettings.CurrentWorkerRuntime, Csx);
         }
 
         private async Task InitFunctionAppProject()
@@ -181,7 +181,7 @@ private async Task InitFunctionAppProject()
             }
             if (InitDocker)
             {
-                await WriteDockerfile(workerRuntime);
+                await WriteDockerfile(workerRuntime, Csx);
             }
         }
 
@@ -301,11 +301,18 @@ private static async Task WriteLocalSettingsJson(WorkerRuntime workerRuntime)
             await WriteFiles("local.settings.json", localSettingsJsonContent);
         }
 
-        private static async Task WriteDockerfile(WorkerRuntime workerRuntime)
+        private static async Task WriteDockerfile(WorkerRuntime workerRuntime, bool csx)
         {
             if (workerRuntime == Helpers.WorkerRuntime.dotnet)
             {
-                await WriteFiles("Dockerfile", await StaticResources.DockerfileDotNet);
+                if (csx)
+                {
+                    await WriteFiles("Dockerfile", await StaticResources.DockerfileCsxDotNet);
+                }
+                else
+                {
+                    await WriteFiles("Dockerfile", await StaticResources.DockerfileDotNet);
+                }
             }
             else if (workerRuntime == Helpers.WorkerRuntime.node)
             {
diff --git a/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj b/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
index a2fc1fb98..0c599fdda 100644
--- a/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
+++ b/src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
@@ -30,6 +30,9 @@
     <EmbeddedResource Include="StaticResources\ExtensionsProj.csproj.template">
       <LogicalName>$(AssemblyName).ExtensionsProj.csproj</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="StaticResources\Dockerfile.csx.dotnet">
+      <LogicalName>$(AssemblyName).Dockerfile.csx.dotnet</LogicalName>
+    </EmbeddedResource>
     <EmbeddedResource Include="StaticResources\Dockerfile.dotnet">
       <LogicalName>$(AssemblyName).Dockerfile.dotnet</LogicalName>
     </EmbeddedResource>
diff --git a/src/Azure.Functions.Cli/StaticResources/Dockerfile.csx.dotnet b/src/Azure.Functions.Cli/StaticResources/Dockerfile.csx.dotnet
new file mode 100644
index 000000000..4e3d5a2ce
--- /dev/null
+++ b/src/Azure.Functions.Cli/StaticResources/Dockerfile.csx.dotnet
@@ -0,0 +1,5 @@
+FROM mcr.microsoft.com/azure-functions/dotnet:2.0
+ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
+    AzureFunctionsJobHost__Logging__Console__IsEnabled=true
+
+COPY . /home/site/wwwroot
diff --git a/src/Azure.Functions.Cli/StaticResources/StaticResources.cs b/src/Azure.Functions.Cli/StaticResources/StaticResources.cs
index a60d69222..dedd9580b 100644
--- a/src/Azure.Functions.Cli/StaticResources/StaticResources.cs
+++ b/src/Azure.Functions.Cli/StaticResources/StaticResources.cs
@@ -31,6 +31,8 @@ private static async Task<string> GetValue(string name)
 
         public static Task<string> DockerfileDotNet => GetValue("Dockerfile.dotnet");
 
+        public static Task<string> DockerfileCsxDotNet => GetValue("Dockerfile.csx.dotnet");
+
         public static Task<string> DockerfilePython => GetValue("Dockerfile.python");
 
         public static Task<string> DockerfileNode => GetValue("Dockerfile.node");
diff --git a/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs b/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs
index 521eee517..aaa542250 100644
--- a/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs
+++ b/test/Azure.Functions.Cli.Tests/E2E/InitTests.cs
@@ -136,6 +136,25 @@ public Task init_with_Dockerfile(string workerRuntime)
             }, _output);
         }
 
+        [Fact]
+        public Task init_with_Dockerfile_for_csx()
+        {
+            return CliTester.Run(new RunConfiguration
+            {
+                Commands = new[] { $"init . --worker-runtime dotnet --docker --csx" },
+                CheckFiles = new[]
+                {
+                    new FileResult
+                    {
+                        Name = "Dockerfile",
+                        ContentNotContains = new[] { "dotnet publish" },
+                        ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:2.0" }
+                    }
+                },
+                OutputContains = new[] { "Dockerfile" }
+            }, _output);
+        }
+
         [Fact]
         public Task init_csx_app()
         {
@@ -293,6 +312,29 @@ public Task init_docker_only_for_existing_project(string workerRuntime)
             }, _output);
         }
 
+        [Fact]
+        public Task init_docker_only_for_csx_project()
+        {
+            return CliTester.Run(new RunConfiguration
+            {
+                Commands = new[]
+                {
+                    $"init . --worker-runtime dotnet --csx",
+                    $"init . --docker-only --csx",
+                },
+                CheckFiles = new[]
+                {
+                    new FileResult
+                    {
+                        Name = "Dockerfile",
+                        ContentNotContains = new[] { "dotnet publish" },
+                        ContentContains = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet:2.0" }
+                    }
+                },
+                OutputContains = new[] { "Dockerfile" }
+            }, _output);
+        }
+
         [Fact]
         public Task init_docker_only_no_project()
         {

From 2b4f90edf81310c6f55695a6cf1b1571fc766c42 Mon Sep 17 00:00:00 2001
From: "Hanzhang Zeng (Roger)" <hazeng@microsoft.com>
Date: Fri, 16 Aug 2019 16:12:58 -0700
Subject: [PATCH 3/3] Updated error message when the function app is created
 before aug 1st.

---
 .../Actions/AzureActions/PublishFunctionAppAction.cs          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs b/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs
index 2721cb685..20ab689e0 100644
--- a/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs
+++ b/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs
@@ -637,8 +637,8 @@ public async Task<DeployStatus> PerformServerSideBuild(Site functionApp, Func<Ta
         {
             if (string.IsNullOrEmpty(functionApp.ScmUri))
             {
-                throw new CliException($"Your function app {functionApp.SiteName} does not support remote build. " + 
-                    "To enable remote build, please update your function app to the latest verison by recreating it.");
+                throw new CliException("Remote build is a new feature added to function apps. " +
+                    $"Your function app {functionApp.SiteName} does not support remote build as it was created before August 1st, 2019.");
             }
 
             using (var handler = new ProgressMessageHandler(new HttpClientHandler()))