Skip to content

Commit 8b09b6a

Browse files
Additional edits.
1 parent 5cc05ea commit 8b09b6a

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

articles/azure-functions/functions-dotnet-class-library.md

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ Version 4.x of the Functions runtime provides equivalent functionality for .NET
9090

9191
In Visual Studio, the **Azure Functions** project template creates a C# class library project that contains the following files:
9292

93-
* [host.json](functions-host-json.md) - stores configuration settings that affect all functions in the project when running locally or in Azure.
94-
* [local.settings.json](functions-develop-local.md#local-settings-file) - stores app settings and connection strings that are used when running locally. This file contains secrets and isn't published to your function app in Azure. Instead, [add app settings to your function app](functions-develop-vs.md#function-app-settings).
93+
- [host.json](functions-host-json.md) - stores configuration settings that affect all functions in the project when running locally or in Azure.
94+
- [local.settings.json](functions-develop-local.md#local-settings-file) - stores app settings and connection strings that are used when running locally. This file contains secrets and isn't published to your function app in Azure. Instead, [add app settings to your function app](functions-develop-vs.md#function-app-settings).
9595

9696
When you build the project, a folder structure that looks like the following example is generated in the build output directory:
9797

98-
```
98+
```text
9999
<framework.version>
100100
| - bin
101101
| - MyFirstFunction
@@ -110,7 +110,6 @@ This directory is what gets deployed to your function app in Azure. The binding
110110
> [!IMPORTANT]
111111
> The build process creates a *function.json* file for each function. This *function.json* file isn't meant to be edited directly. You can't change binding configuration or disable the function by editing this file. To learn how to disable a function, see [How to disable functions](disable-function.md).
112112
113-
114113
## Methods recognized as functions
115114

116115
In a class library, a function is a method with a `FunctionName` and a trigger attribute, as shown in the following example:
@@ -136,16 +135,16 @@ The trigger attribute specifies the trigger type and binds input data to a metho
136135

137136
The method signature might contain parameters other than the one used with the trigger attribute. Here are some of the other parameters that you can include:
138137

139-
* [Input and output bindings](functions-triggers-bindings.md) marked as such by decorating them with attributes.
140-
* An `ILogger` or `TraceWriter` ([version 1.x-only](functions-versions.md#creating-1x-apps)) parameter for [logging](#logging).
141-
* A `CancellationToken` parameter for [graceful shutdown](#cancellation-tokens).
142-
* [Binding expressions](./functions-bindings-expressions-patterns.md) parameters to get trigger metadata.
138+
- [Input and output bindings](functions-triggers-bindings.md) marked as such by decorating them with attributes.
139+
- An `ILogger` or `TraceWriter` ([version 1.x-only](functions-versions.md#creating-1x-apps)) parameter for [logging](#logging).
140+
- A `CancellationToken` parameter for [graceful shutdown](#cancellation-tokens).
141+
- [Binding expressions](./functions-bindings-expressions-patterns.md) parameters to get trigger metadata.
143142

144143
The order of parameters in the function signature doesn't matter. For example, you can put trigger parameters before or after other bindings, and you can put the logger parameter before or after trigger or binding parameters.
145144

146145
### Output bindings
147146

148-
A function can have zero or multiple output bindings defined by using output parameters.
147+
A function can have zero or multiple output bindings defined by using output parameters.
149148

150149
The following example modifies the preceding one by adding an output queue binding named `myQueueItemCopy`. The function writes the contents of the message that triggers the function to a new message in a different queue.
151150

@@ -189,7 +188,7 @@ public static class BindingExpressionsExample
189188

190189
## Autogenerated function.json
191190

192-
The build process creates a *function.json* file in a function folder in the build folder. As noted earlier, this file isn't meant to be edited directly. You can't change binding configuration or disable the function by editing this file.
191+
The build process creates a *function.json* file in a function folder in the build folder. As noted earlier, this file isn't meant to be edited directly. You can't change binding configuration or disable the function by editing this file.
193192

194193
The purpose of this file is to provide information to the scale controller to use for [scaling decisions on the Consumption plan](event-driven-scaling.md). For this reason, the file only has trigger info, not input/output bindings.
195194

@@ -214,7 +213,7 @@ The generated *function.json* file includes a `configurationSource` property tha
214213

215214
## Microsoft.NET.Sdk.Functions
216215

217-
The *function.json* file generation is performed by the NuGet package [Microsoft\.NET\.Sdk\.Functions](https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions).
216+
The *function.json* file generation is performed by the NuGet package [Microsoft\.NET\.Sdk\.Functions](https://www.nuget.org/packages/Microsoft.NET.Sdk.Functions).
218217

219218
The following example shows the relevant parts of the `.csproj` files that have different target frameworks of the same `Sdk` package:
220219

@@ -245,7 +244,6 @@ The following example shows the relevant parts of the `.csproj` files that have
245244
```
246245
---
247246

248-
249247
Among the `Sdk` package dependencies are triggers and bindings. A 1.x project refers to 1.x triggers and bindings because those triggers and bindings target the .NET Framework, while 4.x triggers and bindings target .NET Core.
250248

251249
The `Sdk` package also depends on [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json), and indirectly on [WindowsAzure.Storage](https://www.nuget.org/packages/WindowsAzure.Storage). These dependencies make sure that your project uses the versions of those packages that work with the Functions runtime version that the project targets. For example, `Newtonsoft.Json` has version 11 for .NET Framework 4.6.1, but the Functions runtime that targets .NET Framework 4.6.1 is only compatible with `Newtonsoft.Json` 9.0.1. So your function code in that project also has to use `Newtonsoft.Json` 9.0.1.
@@ -292,7 +290,7 @@ Each binding has its own supported types; for instance, a blob trigger attribute
292290

293291
## Binding to method return value
294292

295-
You can use a method return value for an output binding, by applying the attribute to the method return value. For examples, see [Triggers and bindings](./functions-triggers-bindings.md).
293+
You can use a method return value for an output binding, by applying the attribute to the method return value. For examples, see [Triggers and bindings](./functions-triggers-bindings.md).
296294

297295
Use the return value only if a successful function execution always results in a return value to pass to the output binding. Otherwise, use `ICollector` or `IAsyncCollector`, as shown in the following section.
298296

@@ -452,7 +450,7 @@ Install-Package Microsoft.Azure.WebJobs.Logging.ApplicationInsights -Version <VE
452450

453451
---
454452

455-
In this command, replace `<VERSION>` with a version of this package that supports your installed version of [Microsoft.Azure.WebJobs](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/).
453+
In this command, replace `<VERSION>` with a version of this package that supports your installed version of [Microsoft.Azure.WebJobs](https://www.nuget.org/packages/Microsoft.Azure.WebJobs/).
456454
457455
The following C# examples uses the [custom telemetry API](/azure/azure-monitor/app/api-custom-events-metrics). The example is for a .NET class library, but the Application Insights code is the same for C# script.
458456

@@ -530,7 +528,6 @@ In this example, the custom metric data gets aggregated by the host before being
530528

531529
When running locally, you must add the `APPINSIGHTS_INSTRUMENTATIONKEY` setting, with the Application Insights key, to the [local.settings.json](functions-develop-local.md#local-settings-file) file.
532530

533-
534531
# [v1.x](#tab/v1)
535532

536533
```cs
@@ -621,9 +618,9 @@ Don't set `telemetryClient.Context.Operation.Id`. This global setting causes inc
621618

622619
The following articles show how to run an in-process C# class library function locally for testing purposes:
623620

624-
+ [Visual Studio](functions-develop-vs.md#testing-functions)
625-
+ [Visual Studio Code](functions-develop-vs-code.md?tabs=csharp#debugging-functions-locally)
626-
+ [Command line](functions-run-local.md?tabs=v4%2Ccsharp%2Cazurecli%2Cbash#start)
621+
- [Visual Studio](functions-develop-vs.md#testing-functions)
622+
- [Visual Studio Code](functions-develop-vs-code.md?tabs=csharp#debugging-functions-locally)
623+
- [Command line](functions-run-local.md?tabs=v4%2Ccsharp%2Cazurecli%2Cbash#start)
627624

628625
## Environment variables
629626

@@ -695,15 +692,11 @@ public static class IBinderExample
695692
}
696693
```
697694

698-
[BlobAttribute](https://github.com/Azure/azure-webjobs-sdk/blob/master/src/Microsoft.Azure.WebJobs.Extensions.Storage/Blobs/BlobAttribute.cs)
699-
defines the [Storage blob](functions-bindings-storage-blob.md) input or output binding, and
700-
[TextWriter](/dotnet/api/system.io.textwriter) is a supported output binding type.
695+
[BlobAttribute](https://github.com/Azure/azure-webjobs-sdk/blob/master/src/Microsoft.Azure.WebJobs.Extensions.Storage/Blobs/BlobAttribute.cs) defines the [Storage blob](functions-bindings-storage-blob.md) input or output binding, and [TextWriter](/dotnet/api/system.io.textwriter) is a supported output binding type.
701696
702697
### Multiple attributes example
703698

704-
The preceding example gets the app setting for the function app's main Storage account connection string (which is `AzureWebJobsStorage`). You can specify a custom app setting to use for the Storage account by adding the
705-
[StorageAccountAttribute](https://github.com/Azure/azure-webjobs-sdk/blob/master/src/Microsoft.Azure.WebJobs/StorageAccountAttribute.cs)
706-
and passing the attribute array into `BindAsync<T>()`. Use a `Binder` parameter, not `IBinder`. For example:
699+
The preceding example gets the app setting for the function app's main Storage account connection string (which is `AzureWebJobsStorage`). You can specify a custom app setting to use for the Storage account by adding the [StorageAccountAttribute](https://github.com/Azure/azure-webjobs-sdk/blob/master/src/Microsoft.Azure.WebJobs/StorageAccountAttribute.cs) and passing the attribute array into `BindAsync<T>()`. Use a `Binder` parameter, not `IBinder`. For example:
707700

708701
```cs
709702
public static class IBinderExampleMultipleAttributes
@@ -728,7 +721,7 @@ public static class IBinderExampleMultipleAttributes
728721
}
729722
```
730723

731-
## Triggers and bindings
724+
## Triggers and bindings
732725

733726
[!INCLUDE [Supported triggers and bindings](../../includes/functions-bindings.md)]
734727

0 commit comments

Comments
 (0)