Skip to content

Commit

Permalink
updating .NET templates and updating .NET model prompts (#3615)
Browse files Browse the repository at this point in the history
* updating .NET templates and updating .NET model prompts

* Adding AzureWebJobsSecretStorageType in the local app settings.

* removing invalid test for user secrets

* Updated Microsoft.Identity.Client.

---------

Co-authored-by: khkh@microsoft.com <khkh@microsoft.com>
  • Loading branch information
mattchenderson and khkh-ms committed Apr 17, 2024
1 parent 62d4983 commit 5bf3f53
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions build/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ private static string config(string @default = null, [CallerMemberName] string k
: value;
}

public const string DotnetIsolatedItemTemplatesVersion = "4.0.2848";
public const string DotnetIsolatedProjectTemplatesVersion = "4.0.2848";
public const string DotnetItemTemplatesVersion = "4.0.2848";
public const string DotnetProjectTemplatesVersion = "4.0.2848";
public const string DotnetIsolatedItemTemplatesVersion = "4.0.2945";
public const string DotnetIsolatedProjectTemplatesVersion = "4.0.2945";
public const string DotnetItemTemplatesVersion = "4.0.2945";
public const string DotnetProjectTemplatesVersion = "4.0.2945";
public const string TemplateJsonVersion = "3.1.1648";

public static readonly string SBOMManifestToolPath = Path.GetFullPath("../ManifestTool/Microsoft.ManifestTool.dll");
Expand Down
1 change: 1 addition & 0 deletions src/Azure.Functions.Cli/Azure.Functions.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage.Internal" Version="1.4.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.33.1" />
<PackageReference Include="Microsoft.Build" Version="17.0.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.60.3" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.35.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NuGet.Packaging" Version="5.11.6" />
Expand Down
2 changes: 1 addition & 1 deletion src/Azure.Functions.Cli/Helpers/GlobalCoreToolsSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static WorkerRuntime CurrentWorkerRuntime
{
if (_currentWorkerRuntime == WorkerRuntime.None)
{
ColoredConsole.Error.WriteLine(QuietWarningColor("Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]"));
ColoredConsole.Error.WriteLine(QuietWarningColor("Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]"));
}
return _currentWorkerRuntime;
}
Expand Down
10 changes: 7 additions & 3 deletions src/Azure.Functions.Cli/Helpers/WorkerRuntimeLanguageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public static class WorkerRuntimeLanguageHelper
{
private static readonly IDictionary<WorkerRuntime, IEnumerable<string>> availableWorkersRuntime = new Dictionary<WorkerRuntime, IEnumerable<string>>
{
{ WorkerRuntime.dotnet, new [] { "c#", "csharp", "f#", "fsharp" } },
{ WorkerRuntime.dotnetIsolated, new [] { "dotnet-isolated", "c#-isolated", "csharp-isolated", "f#-isolated", "fsharp-isolated" } },
{ WorkerRuntime.dotnet, new [] { "c#", "csharp", "f#", "fsharp" } },
{ WorkerRuntime.node, new [] { "js", "javascript", "typescript", "ts" } },
{ WorkerRuntime.python, new [] { "py" } },
{ WorkerRuntime.java, new string[] { } },
Expand Down Expand Up @@ -76,7 +76,8 @@ public static class WorkerRuntimeLanguageHelper
public static string AvailableWorkersRuntimeString =>
string.Join(", ", availableWorkersRuntime.Keys
.Where(k => (k != WorkerRuntime.java))
.Select(s => s.ToString()));
.Select(s => s.ToString()))
.Replace(WorkerRuntime.dotnetIsolated.ToString(), "dotnet-isolated");

public static string GetRuntimeMoniker(WorkerRuntime workerRuntime)
{
Expand Down Expand Up @@ -110,8 +111,11 @@ public static string GetRuntimeMoniker(WorkerRuntime workerRuntime)
{
switch (wr)
{
case WorkerRuntime.dotnet:
workerToDisplayStrings[wr] = "dotnet (in-process model)";
break;
case WorkerRuntime.dotnetIsolated:
workerToDisplayStrings[wr] = "dotnet (isolated process)";
workerToDisplayStrings[wr] = "dotnet (isolated worker model)";
break;
default:
workerToDisplayStrings[wr] = wr.ToString();
Expand Down
7 changes: 3 additions & 4 deletions test/Azure.Functions.Cli.Tests/E2E/StartTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public async Task only_run_some_functions()
}, _output);
}

[Theory]
[Theory(Skip = "https://github.com/Azure/azure-functions-core-tools/issues/3644")]
[InlineData("dotnet")]
[InlineData("dotnet-isolated")]
public async Task start_with_user_secrets(string language)
Expand Down Expand Up @@ -615,20 +615,19 @@ public async Task start_with_user_secrets(string language)
var localSettingsPath = Path.Combine(workingDir, "local.settings.json");
Assert.True(File.Exists(queueCodePath));
_output.WriteLine($"Writing to file {localSettingsPath}");
File.WriteAllText(localSettingsPath, "{ \"IsEncrypted\": false, \"Values\": {} }");
File.WriteAllText(localSettingsPath, "{ \"IsEncrypted\": false, \"Values\": {\""+ Constants.FunctionsWorkerRuntime + "\": \"" + language + "\", \"AzureWebJobsSecretStorageType\": \"files\"} }");
// init and set user secrets
Dictionary<string, string> userSecrets = new Dictionary<string, string>()
{
{ Constants.AzureWebJobsStorage, "UseDevelopmentStorage=true" },
{ Constants.FunctionsWorkerRuntime, "dotnet" },
{ "ConnectionStrings:MyQueueConn", "DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=GMuzNHjlB3S9itqZJHHCnRkrokLkcSyW7yK9BRbGp0ENePunLPwBgpxV1Z/pVo9zpem/2xSHXkMqTHHLcx8XRA==EndpointSuffix=core.windows.net" },
};
SetUserSecrets(workingDir, userSecrets);
},
Commands = new[]
{
"start --functions http1 --csharp",
"start --functions http1 --" + language,
},
ExpectExit = false,
OutputContains = new string[]
Expand Down

0 comments on commit 5bf3f53

Please sign in to comment.