-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat(vscode): Introduce .NET 8 to custom code (#4953)
* feat(vscode): Introduce .NET 8 to custom code and extension dependencies (#4947) * Add validation for multiple dotnet versions * Add comments and return in the await * Fix command execution * Add version to switch to nuget based * Add code to differentiate .net7 and netfx * Add .NET8 files and creation file decision * Update to function * Add selfContained * Remove .NET 6 * Move target framework step after workspace type step * Remove nuget config file * Upgrade packages * Add new dotnetMulti prop for manifest * Update pack command to build all projects for extension * Add comments and remove extra wizard context property * fix(vscode): Update Workflows Webjobs sdk version (#4952) Update Workflows Webjobs sdk version
1 parent
b884d6f
commit 74a5363
Showing
27 changed files
with
450 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ommands/createNewCodeProject/createCodeProjectSteps/createFunction/TargetFrameworkStep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { type IProjectWizardContext, TargetFramework, ProjectType } from '@microsoft/vscode-extension-logic-apps'; | ||
import { localize } from '../../../../../localize'; | ||
import { AzureWizardPromptStep, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils'; | ||
import { Platform } from '../../../../../constants'; | ||
|
||
/** | ||
* Represents a step in the project creation wizard for selecting the target framework. | ||
*/ | ||
export class TargetFrameworkStep extends AzureWizardPromptStep<IProjectWizardContext> { | ||
public hideStepCount = true; | ||
|
||
/** | ||
* Prompts the user to select a target framework. | ||
* @param {IProjectWizardContext} context - The project wizard context. | ||
*/ | ||
public async prompt(context: IProjectWizardContext): Promise<void> { | ||
const placeHolder: string = localize('selectTargetFramework', 'Select a target framework.'); | ||
const picks: IAzureQuickPickItem<TargetFramework>[] = [{ label: localize('Net8', '.NET 8'), data: TargetFramework.Net8 }]; | ||
if (process.platform === Platform.windows) { | ||
picks.unshift({ label: localize('NetFx', '.NET Framework'), data: TargetFramework.NetFx }); | ||
} | ||
context.targetFramework = (await context.ui.showQuickPick(picks, { placeHolder })).data; | ||
} | ||
|
||
/** | ||
* Determines whether this step should be prompted based on the project wizard context. | ||
* @param {IProjectWizardContext} context - The project wizard context. | ||
* @returns True if this step should be prompted, false otherwise. | ||
*/ | ||
public shouldPrompt(context: IProjectWizardContext): boolean { | ||
return context.projectType === ProjectType.customCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
apps/vs-code-designer/src/assets/FunctionProjectTemplate/FunctionsFileNet8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
|
||
namespace <%= namespace %> | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Functions.Extensions.Workflows; | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Extensions.Logging; | ||
|
||
/// <summary> | ||
/// Represents the <%= methodName %> flow invoked function. | ||
/// </summary> | ||
public class <%= methodName %> | ||
{ | ||
private readonly ILogger<<%= methodName %>> logger; | ||
|
||
public <%= methodName %>(ILoggerFactory loggerFactory) | ||
{ | ||
logger = loggerFactory.CreateLogger<<%= methodName %>>(); | ||
} | ||
|
||
/// <summary> | ||
/// Executes the logic app workflow. | ||
/// </summary> | ||
/// <param name="zipCode">The zip code.</param> | ||
/// <param name="temperatureScale">The temperature scale (e.g., Celsius or Fahrenheit).</param> | ||
[Function("<%= methodName %>")] | ||
public Task<Weather> Run([WorkflowActionTrigger] int zipCode, string temperatureScale) | ||
{ | ||
this.logger.LogInformation("Starting <%= methodName %> with Zip Code: " + zipCode + " and Scale: " + temperatureScale); | ||
|
||
// Generate random temperature within a range based on the temperature scale | ||
Random rnd = new Random(); | ||
var currentTemp = temperatureScale == "Celsius" ? rnd.Next(1, 30) : rnd.Next(40, 90); | ||
var lowTemp = currentTemp - 10; | ||
var highTemp = currentTemp + 10; | ||
|
||
// Create a Weather object with the temperature information | ||
var weather = new Weather() | ||
{ | ||
ZipCode = zipCode, | ||
CurrentWeather = $"The current weather is {currentTemp} {temperatureScale}", | ||
DayLow = $"The low for the day is {lowTemp} {temperatureScale}", | ||
DayHigh = $"The high for the day is {highTemp} {temperatureScale}" | ||
}; | ||
|
||
return Task.FromResult(weather); | ||
} | ||
|
||
/// <summary> | ||
/// Represents the weather information for <%= methodName %>. | ||
/// </summary> | ||
public class Weather | ||
{ | ||
/// <summary> | ||
/// Gets or sets the zip code. | ||
/// </summary> | ||
public int ZipCode { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the current weather. | ||
/// </summary> | ||
public string CurrentWeather { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the low temperature for the day. | ||
/// </summary> | ||
public string DayLow { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the high temperature for the day. | ||
/// </summary> | ||
public string DayHigh { get; set; } | ||
} | ||
} | ||
} |
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
apps/vs-code-designer/src/assets/FunctionProjectTemplate/FunctionsProjNet8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<IsPackable>false</IsPackable> | ||
<TargetFramework>net8</TargetFramework> | ||
<AzureFunctionsVersion>v4</AzureFunctionsVersion> | ||
<OutputType>Library</OutputType> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<!-- Please replace 'LogicAppFolder' with the name of your folder that contains your logic app project. --> | ||
<LogicAppFolder>LogicApp</LogicAppFolder> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
<SelfContained>false</SelfContained> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Abstractions" Version="1.3.0" /> | ||
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.15.1" /> | ||
<PackageReference Include="Microsoft.Azure.Workflows.Webjobs.Sdk" Version="1.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" /> | ||
</ItemGroup> | ||
|
||
<Target Name="Task" AfterTargets="Compile"> | ||
<ItemGroup> | ||
<DirsToClean2 Include="..\$(LogicAppFolder)\lib\custom" /> | ||
</ItemGroup> | ||
<RemoveDir Directories="@(DirsToClean2)" /> | ||
</Target> | ||
|
||
<Target Name="CopyExtensionFiles" AfterTargets="ParameterizedFunctionJsonGeneratorNetCore"> | ||
<ItemGroup> | ||
<CopyFiles Include="$(MSBuildProjectDirectory)\bin\$(Configuration)\net8\**\*.*" CopyToOutputDirectory="PreserveNewest" Exclude="$(MSBuildProjectDirectory)\bin\$(Configuration)\net8\*.*" /> | ||
<CopyFiles2 Include="$(MSBuildProjectDirectory)\bin\$(Configuration)\net8\*.*" /> | ||
</ItemGroup> | ||
<Copy SourceFiles="@(CopyFiles)" DestinationFolder="..\$(LogicAppFolder)\lib\custom\%(RecursiveDir)" SkipUnchangedFiles="true" /> | ||
<Copy SourceFiles="@(CopyFiles2)" DestinationFolder="..\$(LogicAppFolder)\lib\custom\net8\" SkipUnchangedFiles="true" /> | ||
<ItemGroup> | ||
<MoveFiles Include="..\$(LogicAppFolder)\lib\custom\bin\*.*" /> | ||
</ItemGroup> | ||
|
||
<Move SourceFiles="@(MoveFiles)" DestinationFolder="..\$(LogicAppFolder)\lib\custom\net8" /> | ||
<ItemGroup> | ||
<DirsToClean Include="..\$(LogicAppFolder)\lib\custom\bin" /> | ||
</ItemGroup> | ||
<RemoveDir Directories="@(DirsToClean)" /> | ||
</Target> | ||
|
||
<ItemGroup> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="bin\$(Configuration)\net8\" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ | |
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0" | ||
}, | ||
"type": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ export const useStyles = makeStyles({ | |
searchBox: { | ||
width: '85%', | ||
alignSelf: 'center', | ||
} | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters