When I generate C# classes with NSwag via MSBuild
(following this wiki: https://github.com/RicoSuter/NSwag/wiki/MSBuild),
the code is generated. But for the first time I make the build (when there are no generated classes yet), I get an error that compiler cannot see those classes. As I have the references in code to the generated classes.
Do you have any idea on how to change the MSBuild script to make it see the newly generated classes?
I have found a workaround for that issue. Details here:
https://stackoverflow.com/questions/57446692/msbuild-how-to-include-generated-classes-into-compilation/57457347#57457347
For a fully worked example with NSwag and MSBuild, I wrote a post here that could be of interest: https://stu.dev/generating-typed-client-for-httpclientfactory-with-nswag/
@KrzysztofKielce mate you saved my day. What I still don't understand is how come that it's absent from the official documentation? It simply doesn't work without your "workaround".
I am happy to help! You can vote me up on stack overflow, if you want.
Did you try Slang's solution? Does it work for you? It seems less hacky.
Most helpful comment
I have found a workaround for that issue. Details here:
https://stackoverflow.com/questions/57446692/msbuild-how-to-include-generated-classes-into-compilation/57457347#57457347