Open lscorcia opened 3 years ago
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Yep, this is a bug in the MSBuild condition here. It's valid to avoid multiple invocations for multiple targets but this disables it all together. I think a condition like:
Condition="'$(TargetFrameworks)' == '' OR $(TargetFrameworks.EndsWith($(TargetFramework)))"
Get us a little closer to doing the invocation for only the TFM That appears first. We might have to tweak it a bit to account for projects that target more than 2 TFMs.
Thanks for contacting us.
We're moving this issue to the .NET 8 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Not sure if it's related to this issue, but it appears to be a typo here: https://github.com/dotnet/aspnetcore/blob/e7a85fb5de16cb888783537f2374d16bcb9678dc/src/Tools/Extensions.ApiDescription.Client/src/buildMultiTargeting/Microsoft.Extensions.ApiDescription.Client.targets#L18 with two apostrophes before $(OpenApiGenerateCodeOnBuild)
I had to workaround it by setting TargetFrameworks
to single/current value before running GenerateOpenApiCode
during compilation
Sample here: https://gist.github.com/AdelRefaat/dc3258c86e2d6e8a06fbff921c0baf96
Minimal repro project here: https://github.com/lscorcia/aspnetcore-issue31996-repro
I have a library which is using multitargeting - in the .csproj it has:
I added to it an OpenAPI connected service via VS2019 GUI (16.9.4):
It added some nuget packages to the project, and the OpenApiReference element:
The build completes fine, no error or warnings, however it does not generate the corresponding source code in the
obj
folder. If I replace the multitargeting with a single target however it works correctly:Looking at the build logs, it seems like the following condition fails and does not run the OpenAPI code generation:
https://github.com/dotnet/aspnetcore/blob/ec69111cd568dbc7b06f62851bea3b452e404972/src/Tools/Extensions.ApiDescription.Client/src/build/Microsoft.Extensions.ApiDescription.Client.targets#L161-L164
Relevant msbuild.log entry (in Italian, but should be easily readable):
I can see why one wouldn't want to run the generation multiple times, but it does not run at all.