I'm getting a build error in my Vazor project:
Google.Protobuf.Tools proto compilation is only supported by default in a C# project
However, I'm not doing proto compilation in this project. The codegen project is a C# project, which I'm referencing in my Vazor project. Apparently the compiler isn't smart enough to figure that out.
Here's the relevant snippet from the Google.Protobuf.Tools.Targets
file:
<!-- Check configuration sanity before build. -->
<Target Name="_Protobuf_SanityCheck" BeforeTargets="PrepareForBuild">
<Error
Condition=" '$(Protobuf_ProjectSupported)' != 'true' "
Text="Google.Protobuf.Tools proto compilation is only supported by default in a C# project (extension .csproj)" />
</Target>
This started when I added the Grpc.AspNetCore
package, so I could do this in Startup.vb
:
Services.AddGrpc
I tried commenting out the <Error />
element, and that works, but it's a hack—and a pretty lousy one at that. Q&As like this one come close, but they don't really address the problem.
Here's a repro project. Build VazorMVC1 and you'll see the error.
Is there a dignified way to suppress this error so my project can build, perhaps in declarative MSBuild syntax, without my having to alter the targets file?