-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[release/8.0] Fix auto import of proto files when gRPC JSON transcoding is a transitive reference #52470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @github-actions[bot]. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document. |
Hi @github-actions[bot]. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
Hi @github-actions[bot]. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed. |
Email approval |
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Backport of #52443 to release/8.0
/cc @JamesNK
Fix auto import of proto files when gRPC JSON transcoding is a transitive reference
gRPC JSON transcoding needs a proto file to be an app's source code directory. In .NET 7, the file had to be manually downloaded and copied to the right location. .NET 8 introduces a Cool Trick to bundle proto files in the package and automatically include them in the proto compilation. This uses msbuild that is shipped with in the nuget package.
The documentation relies on people enabling this feature: https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding?view=aspnetcore-8.0#usage
The msbuild file is in the package's
/build
directory, which means it doesn't run when Microsoft.AspNetCore.Grpc.JsonTranscoding is transitively referenced by the web app. e.g. app -> CustomLibrary -> Microsoft.AspNetCore.Grpc.JsonTranscoding.The fix is to also put the msbuild file in
/buildTransitive
.Customer Impact
If Microsoft.AspNetCore.Grpc.JsonTranscoding is transitively referenced by a developer's app then the app will fail to compile.
The work around is to add a direct reference to Microsoft.AspNetCore.Grpc.JsonTranscoding. However, because including the proto file happens behind the scenes, it will be very difficult for a developer to figure out what has gone wrong and how to fix it.
Regression?
[If yes, specify the version the behavior has regressed from]
Risk
This is a minor change is to the Microsoft.AspNetCore.Grpc.JsonTranscoding package. Nothing else in .NET depends on it, and the feature that is impacted is opt-in (requires an msbuild property to enable).
Verification
Before:

After:

Packaging changes reviewed?
When servicing release/2.1