Skip to content

Commit c04f336

Browse files
authored
Merge pull request #10591 from changeworld/patch-5
Fix typo
2 parents a70c2d2 + 7950e2e commit c04f336

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/msbuild/tutorial-rest-api-client-msbuild.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The complete code is in the *PetReaderExecTaskExample* folder; you can download
5151

5252
1. In the `PetShopRestClient` project, add a folder (named `PetShopRestClient`) for the code generation and delete the *Class1.cs* that was automatically generated.
5353

54-
1. Create a text file named *petshop-openapi-spec.json* at the root of the project. Copy the OpenApi spec from [here](https://petstore.swagger.io/v2/swagger.json) and save it in the file. It's best to copy a snapshot of the spec instead of reading it online during the build. You always want a consistently reproducible build that depends only on the input. Consuming the API directly could transform a build which works today to a build which fails tomorrow from the same source. The snapshot saved on *petshop-openapi-spec.json* will allow us to still have a version that builds even if the spec changes.
54+
1. Create a text file named *petshop-openapi-spec.json* at the root of the project. Copy the OpenAPI spec from [here](https://petstore.swagger.io/v2/swagger.json) and save it in the file. It's best to copy a snapshot of the spec instead of reading it online during the build. You always want a consistently reproducible build that depends only on the input. Consuming the API directly could transform a build which works today to a build which fails tomorrow from the same source. The snapshot saved on *petshop-openapi-spec.json* will allow us to still have a version that builds even if the spec changes.
5555

5656
1. Next, modify PetShopRestClient.csproj and add a [MSBuild targets](msbuild-targets.md) to generate the client during build process.
5757

@@ -121,7 +121,7 @@ Congratulations! Now, you can execute the program to see how it works.
121121

122122
In many cases, using the `Exec` task is good enough to execute an external tool to do something like REST API client code generation, but what if you want to allow REST API client code generation if and only if you don't use an absolute Windows path as input? Or what if you need to calculate in some way where the executable is? When there's any situation where you need to execute some code to do extra work, the [MSBuild Tool Task](/dotnet/api/microsoft.build.utilities.tooltask) is the best solution. The `ToolTask` class is an abstract class derived from MSBuild `Task`. You can define a concrete subclass, which creates a custom MSBuild task. This approach lets you run any code that is needed to prepare for command execution. You should read the tutorial [Create a custom task for code generation](tutorial-custom-task-code-generation.md) first.
123123

124-
You'll create a custom task derived from [MSBuild ToolTask](/dotnet/api/microsoft.build.utilities.tooltask) which will generate a REST API client, but it will be designed to emit an error if you try to reference the OpenApi spec using an http address. NSwag supports an http address as OpenApi spec input, but for the purposes of this example, let's suppose there's a design requirement to disallow that.
124+
You'll create a custom task derived from [MSBuild ToolTask](/dotnet/api/microsoft.build.utilities.tooltask) which will generate a REST API client, but it will be designed to emit an error if you try to reference the OpenAPI spec using an http address. NSwag supports an http address as OpenAPI spec input, but for the purposes of this example, let's suppose there's a design requirement to disallow that.
125125

126126
The complete code is in this `PetReaderToolTaskExample` folder; you can download and take a look. In this tutorial, you'll go through step by step and learn some concepts that you can apply to your own scenarios.
127127

@@ -237,7 +237,7 @@ The next step is to create an app that uses the task.
237237
- Newtonsoft.Json, needed to compile the generated client
238238
- System.ComponentModel.Annotations, needed to compile the generated client
239239

240-
1. In the `PetRestApiClient` project, create a text file named *petshop-openapi-spec.json* (in the project folder). To add the OpenApi spec, copy the content from [here](https://petstore.swagger.io/v2/swagger.json) into the file. We like a reproducible build that depends only on the input, as discussed previously. In this example, you'll raise a build error if a user chooses a URL as the OpenApi spec input.
240+
1. In the `PetRestApiClient` project, create a text file named *petshop-openapi-spec.json* (in the project folder). To add the OpenAPI spec, copy the content from [here](https://petstore.swagger.io/v2/swagger.json) into the file. We like a reproducible build that depends only on the input, as discussed previously. In this example, you'll raise a build error if a user chooses a URL as the OpenAPI spec input.
241241
242242
> [!IMPORTANT]
243243
> A general rebuild won't work. You'll see errors that indicate it's unable to copy or delete `RestApiClientGenerator`.dll'. This is because it's trying to build the MBuild custom task in the same build process which uses it. Select `PetReaderToolTaskConsoleApp` and rebuild only that project. The another solution is put the custom task in a completely independent Visual Studio solution as you did in [Tutorial: Create a custom task](tutorial-custom-task-code-generation.md) example.
@@ -276,7 +276,7 @@ The next step is to create an app that uses the task.
276276

277277
```xml
278278
<PropertyGroup>
279-
<!--The place where the OpenApi spec is in-->
279+
<!--The place where the OpenAPI spec is in-->
280280
<PetClientInputOpenApiSpec>petshop-openapi-spec.json</PetClientInputOpenApiSpec>
281281
<PetClientClientClassName>PetRestApiClient</PetClientClientClassName>
282282
<PetClientClientNamespaceName>PetRestApiClient</PetClientClientNamespaceName>

0 commit comments

Comments
 (0)