Swashbuckle.aspnetcore: Conditional compilation flag NETCOREAPP3_0 is not sufficient anymore when explicitly targeting net5.0

Created on 12 Feb 2021  路  7Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

In version 6.0.4 of Swashbuckle.AspNetCore net5.0 is targeted explicitly. Because of this the conditional compilation flag NETCOREAPP3_0 is not sufficient anymore to differentiate between compilation paths.

For example look here.

I stumbled upon this because my swagger.json is unit tested. My properties inside the swagger suddenly became PascalCase, where they were snake_case previously. This is what led me to the discovery that JsonOptions is most likely no longer used.

Relevant github issues/PRs:

After looking at the comment in the last link, it looks to me that, in order to support all (future and past) SDKs, the flag needs to become:

#if NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0 || NETCOREAPP3_0_OR_GREATER

All 7 comments

Good catch - I could have sworn I鈥檇 updated that compiler conditional but must have somehow missed it. Will try get a fix out later today.

FYI, I think it just needs to be (!NETSTANDARD2_0) as I鈥檝e done in all other places (just missed this one).

Thanks for the quick reply! Just to be sure, there are more places this is still used.

@kevinharing could you pull down the latest 6.0.5 preview from myget.org and let me know if it resolves your issue.

@domaindrivendev I鈥檒l have a look at it on Monday and will let you know. However, I see in the referenced issue that is has been solved.

Fixed by 1172b62d45c22f0bf992a6a5b5d80c8a6445f476. Just kicked off the pipeline for the 6.0.5 release so should be available on Nuget.org shortly.

@domaindrivendev It indeed fixed the issue, thanks!

Was this page helpful?
0 / 5 - 0 ratings