StrawberryShake - Disable regenerating client code at each build

501 views Asked by At

I have a tyical .net 7 client application with StrawberryShake v.12.20.

When I compile and test the app locally, everything works fine. But when I upload it to our CI/CD pipeline (using Autobahn and docker) it fails at the dotnet test command. The error message is CSC : error SS0006: Method not found: 'Void StrawberryShake.CodeGeneration.CSharp.CSharpGeneratorSettings.set_RequestStrategy (StrawberryShake.Tools.Configuration.RequestStrategy)... followed by 60+ lines of error about missing type or namespace that are references to the StrawberryShake generated client code.

I figured that our pipeline is probably not supporting that the StrawberryShake regenerating and overwriting the client code class at build but have no idea how to disable it. Do you have any idea?

I tried setting the emitGeneratedCode property to false in graphqlrc.json file but no effect.

The graphqlrc.json file is the following:

{
  "schema": "schema.graphql",
  "documents": "**/*.graphql",
  "extensions": {
    "strawberryShake": {
      "name": "MyClient",
      "url": "http://localhost:5000/graphql",
      "dependencyInjection": true,
      "strictSchemaValidation": true,
      "hashAlgorithm": "md5",
      "useSingleFile": true,
      "requestStrategy": "Default",
      "outputDirectoryName": "Generated",
      "noStore": false,
      "emitGeneratedCode": true,
      "razorComponents": false,
      "records": {
        "inputs": false,
        "entities": false
      },
      "transportProfiles": [
        {
          "default": "Http",
          "subscription": "WebSocket"
        }
      ]
    }
  }
}

The pipeline command failing is the following:

dotnet test *.sln /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="Program.cs" /p:ExcludeByFile="Startup.cs"
0

There are 0 answers