0

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"
Luca
  • 371
  • 4
  • 15
  • You might need to call `dotnet tool install StrawberryShake.Tools --local`. Read the docs: https://chillicream.com/docs/strawberryshake/v13/get-started/console There's probably something you can remove from your csproj etc which will disable it. – DisplayName Jul 14 '23 at 08:30
  • thanks for the tip! I tried to add that command but no luck. It is probably a limitation of our pipeline. A workaround I found is to remove the package 'StrawberryShake.CodeGeneration.CSharp.Analyzers' through the docker file. This package is doing the regenerating. Without this package + an already generated StrawberryShake file the build works. However this is an ugly workaround. – Luca Jul 28 '23 at 09:01

0 Answers0