Skip to content
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

Fails to build when trying to use the AspNetCore gRPC #286

Closed
hayer opened this issue Jun 3, 2019 · 3 comments
Closed

Fails to build when trying to use the AspNetCore gRPC #286

hayer opened this issue Jun 3, 2019 · 3 comments
Assignees

Comments

@hayer
Copy link

hayer commented Jun 3, 2019

  • .NET Core Version: 3.0-preview5

  • Windows version: Windows 10, 1903

  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No

Problem description:
Trying to use a gRPC service as shown in the AspNetDocs-repo in a WPF app, <UseWPF>true</UseWPF>, results in a build error. Visual Studio and VSCode does not report the problem in intellisense but it appears when doing a dotnet build .sln.

Actual behavior:
Results in a

error CS0246: The type or namespace name 'Greet' could not be found (are you missing a using directive or an assembly reference?)

When building. Greet here is the gRPC service defined in a .proto file.

Expected behavior:
Build & run with no error.

Minimal repro:
I made a repro-repo here.

Re-post of issue created at dotnet/wpf#810.

@hayer hayer changed the title Code Issues 186 Pull requests 25 Projects 0 Wiki Security Insights Fails to build when trying to use the AspNetCore gRPC Fails to build when trying to use the AspNetCore gRPC Jun 3, 2019
@JunTaoLuo JunTaoLuo self-assigned this Jun 3, 2019
@JunTaoLuo
Copy link
Contributor

The problem here is that DemoWpfApp is using the Microsoft.NET.Sdk.WindowsDesktop. I'm not familiar with this SDK but it seems like it's not importing the props/targets files of the package dependencies. Hence the code generation targets of Grpc.Tools are not being run and hence why there are missing types during compilation. I see that the DemoService compile successfully because the Microsoft.NET.Sdk.Web that it uses imports the correct props/targets files. @shirhatti, do you know who might be more knowledgeable about the Microsoft.NET.Sdk.WindowsDesktop SDK?

@JunTaoLuo
Copy link
Contributor

Ah I see they came to the same conclusion in the related issue. This seems to be a WPF issue where the gRPC targets are not being picked up due to the package reference not being propagated to the temp project. There's nothing to fix on our side so I'll close this now.

@mirshahreza
Copy link

Hi @JunTaoLuo ,
I had same issue. So I added a new class library project to the solution the I add proto files to it and after that I add the new project as a project reference to the main project. This way I resolved the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants