The JSON files are generated in the path obj\Debug\net8.0\EndpointInfo\*.json
.
Therefore, I am trying to add a target
in the .csproj
file to copy these files after the build
process.
<Target Name="CopySwaggerJson" AfterTargets="Build">
<PropertyGroup>
<EndpointInfoPath>obj\$(Configuration)\$(TargetFramework)\EndpointInfo</EndpointInfoPath>
</PropertyGroup>
<ItemGroup>
<GeneratedJson Include="$(EndpointInfoPath)\*.json" />
</ItemGroup>
<Copy SourceFiles="@(GeneratedJson)" DestinationFolder="$(ProjectDir)" />
</Target>