ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.27k stars 748 forks source link

New Strawberryshake project won't build #6061

Closed Xeviva closed 1 year ago

Xeviva commented 1 year ago

Is there an existing issue for this?

Product

Strawberry Shake

Describe the bug

Following the get started guide (https://chillicream.com/docs/strawberryshake/v13/get-started/console) doesn't work.

I made a fresh solution, followed the guide but I get a build error. The code won't compile.

Steps to reproduce

Reproduction steps:

  1. Installed Visual Studio 2022
  2. Followed this: https://chillicream.com/docs/strawberryshake/v13/get-started/console to create a new solution and console app project, using chilli cream's Conference gql server (targeting .Net 6.0)
  3. Attempted to build solution as per step 5

Expected: Code compiles

Actual: Build error: error MSB4057: The target "GenerateGraphQLCode" does not exist in the project.

Relevant log output

Build started...
1>------ Build started: Project: strawberryTest, Configuration: Debug Any CPU ------
Restored D:\CodeRepos\consoleapp\strawberryTest\strawberryTest\strawberryTest.csproj (in 26 ms).
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(57,11): error MSB4057: The target "GenerateGraphQLCode" does not exist in the project.
1>Done building project "strawberryTest.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 6:43 PM and took 01.690 seconds ==========

Additional Context?

none

Version

13.0.5

michaelstaib commented 1 year ago

Can you attach a demo project here showing this issue?

michaelstaib commented 1 year ago

From the error message it looks like the StrawberryShake.Server package is missing in your project.

Xeviva commented 1 year ago

I'm now running into what looks like an issue with the documents setting in .graphqlrc.json

If I set documents to "**/*.graphql", I get: EXEC : error GQL: An item with the same key has already been added. Key: JSON

If I set documents to "./Documents/*.graphql", and put queries in a Folder called Documents: Warning MSB5029 The value "*\.cs" of the "Include" attribute in element in file ".nuget\packages\strawberryshake.server\13.0.5\build\StrawberryShake.Server.targets (23,16)" is a wildcard that results in enumerating all files on the drive, which was likely not intended. Check that referenced properties are always defined. This occurs with .graphqlrc.json and no client seems to be generated

If I set documents to "GQLDocs/*.graphql" and put docs in GQLDocs: allows the project to build with no errors, but still no client generated, so I can't add the client to the DI, using builder.Services.AddXClient(), with XClient being the name, even with a using for the namespace value set in .graphqlrc.json

can you advise what should be set here as the default isn't working?

{ "schema": "schema.graphql", "documents": "GQLDocs/*.graphql", "extensions": { "strawberryShake": { "name": "XClient", "namespace": "XGQL", "url": "https://someserver.com/graphql", "records": { "inputs": false, "entities": false }, "transportProfiles": [ { "default": "Http", "subscription": "WebSocket" } ] } } }