File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
src/Examples/OpenApiKiotaClientExample Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -226,16 +226,24 @@ The available command-line switches for Kiota are described [here](https://learn
226226
227227At the time of writing, Kiota provides [ no official integration] ( https://github.com/microsoft/kiota/issues/3005 ) with MSBuild.
228228Our [ example project] ( https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/openapi/src/Examples/OpenApiKiotaClientExample ) takes a stab at it,
229- although it has glitches . If you're an MSBuild expert, please help out!
229+ which seems to work . If you're an MSBuild expert, please help out!
230230
231231``` xml
232- <Target Name =" KiotaRunTool" BeforeTargets =" BeforeCompile;CoreCompile" Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
232+ <Target Name =" RemoveKiotaGeneratedCode" BeforeTargets =" BeforeCompile;CoreCompile" Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
233+ <ItemGroup >
234+ <Compile Remove =" **\GeneratedCode\**\*.cs" />
235+ </ItemGroup >
236+ </Target >
237+
238+ <Target Name =" KiotaRunTool" BeforeTargets =" BeforeCompile;CoreCompile" AfterTargets =" RemoveKiotaGeneratedCode"
239+ Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
233240 <Exec
234- Command =" dotnet kiota generate --language CSharp --class-name ExampleApiClient --namespace-name OpenApiKiotaClientExample.GeneratedCode --output ./GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --openapi ..\JsonApiDotNetCoreExample\GeneratedSwagger\JsonApiDotNetCoreExample.json" />
241+ Command =" dotnet kiota generate --language CSharp --class-name ExampleApiClient --namespace-name OpenApiKiotaClientExample.GeneratedCode --output ./GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ../JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json" />
242+ </Target >
235243
244+ <Target Name =" IncludeKiotaGeneratedCode" BeforeTargets =" BeforeCompile;CoreCompile" AfterTargets =" KiotaRunTool"
245+ Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
236246 <ItemGroup >
237- <!-- This isn't entirely reliable: may require a second build after the source swagger.json has changed, to get rid of compile errors. -->
238- <Compile Remove =" **\GeneratedCode\**\*.cs" />
239247 <Compile Include =" **\GeneratedCode\**\*.cs" />
240248 </ItemGroup >
241249</Target >
Original file line number Diff line number Diff line change 2020 <PackageReference Include =" Microsoft.Kiota.Serialization.Text" Version =" $(KiotaVersion)" />
2121 </ItemGroup >
2222
23- <Target Name =" KiotaRunTool" BeforeTargets =" BeforeCompile;CoreCompile" Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
23+ <Target Name =" RemoveKiotaGeneratedCode" BeforeTargets =" BeforeCompile;CoreCompile" Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
24+ <ItemGroup >
25+ <Compile Remove =" **\GeneratedCode\**\*.cs" />
26+ </ItemGroup >
27+ </Target >
28+
29+ <Target Name =" KiotaRunTool" BeforeTargets =" BeforeCompile;CoreCompile" AfterTargets =" RemoveKiotaGeneratedCode"
30+ Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
2431 <!--
2532 Created from sources:
2633 - https://github.com/microsoft/kiota/issues/3005#issuecomment-1657806848
3037 -->
3138 <Exec
3239 Command =" dotnet kiota generate --language CSharp --class-name ExampleApiClient --namespace-name OpenApiKiotaClientExample.GeneratedCode --output ./GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ../JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json" />
40+ </Target >
3341
42+ <Target Name =" IncludeKiotaGeneratedCode" BeforeTargets =" BeforeCompile;CoreCompile" AfterTargets =" KiotaRunTool"
43+ Condition =" $(DesignTimeBuild) != true And $(BuildingProject) == true" >
3444 <ItemGroup >
35- <!-- This isn't entirely reliable: may require a second build after the source swagger.json has changed, to get rid of compile errors. -->
36- <Compile Remove =" **\GeneratedCode\**\*.cs" />
3745 <Compile Include =" **\GeneratedCode\**\*.cs" />
3846 </ItemGroup >
3947 </Target >
You can’t perform that action at this time.
0 commit comments