10.3 MVC .NetCore
After noticing that you use nswag for the angular side of things I ran successfull it to create a C# API using the tools while targeting the swagger.json url. However, because of the rate at which our application changes, I was hoping to generate the file and the client at every build, but I cannot work through errors with targeting the csproj file or the assembly. Any example of this is in the documentation below.
I was wondering if you had any success in performing this during build time rather than run time and if you have any advice.
<PropertyGroup> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> </PropertyGroup> <Target Name="NSwag" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug' "> <Message Importance="High" Text="$(NSwagExe_Net50) run nswag.json /variables:Configuration=$(Configuration)" /> <Exec WorkingDirectory="$(ProjectDir)" EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="$(NSwagExe_Net50) run nswag.json /variables:Configuration=$(Configuration)" /> <Delete Files="$(ProjectDir)\obj\$(MSBuildProjectFile).NSwag.targets" /> <!-- This thingy trigger project rebuild --> </Target>