cake icon indicating copy to clipboard operation
cake copied to clipboard

Old builds fail with error CS1061: 'SolutionParserResult' does not contain a definition for 'GetProjects'

Open iamraghavs opened this issue 7 years ago • 3 comments

What You Are Seeing?

Cake scripts that were working earlier are failing with: error CS1061: 'SolutionParserResult' does not contain a definition for 'GetProjects' and no extension method 'GetProjects' accepting a first argument of type 'SolutionParserResult' could be found (are you missing a using directive or an assembly reference?)

What is Expected?

The SolutionParserResult.GetProjects() method was changed to a property named Projects. This is a breaking change and should not affect people using older versions of Cake

What version of Cake are you using?

v0.30.0. This is also seen when we pin to v0.28.0

Are you running on a 32 or 64 bit system?

64 bit

What environment are you running on? Windows? Linux? Mac?

Windows and a Linux based docker container

Are you running on a CI Server? If so, which one?

Yes, Bamboo

How Did You Get This To Happen? (Steps to Reproduce)

Create a .NET framework solution and use these 2 lines

var solution = ParseSolution(); var projects = solution.GetProjects();

Here is a sample repo to reproduce. Here I have pinned the cake version to 0.30.0 in tools\packages.config: https://github.com/raghav710/CakeScriptTrials

Output Log

 error CS1061: 'SolutionParserResult' does not contain a definition for 'GetProjects' and no extension method 'GetProjects' accepting a first argument of type 'SolutionParserResult' could be found (are you missing a using directive or an assembly reference?)

iamraghavs avatar Feb 27 '19 03:02 iamraghavs

We are using Cake addins like Cake.Docker and Cake.Sonar if that is relevant

iamraghavs avatar Feb 27 '19 03:02 iamraghavs

We found out that this was because we were using Cake.Incubator without specifying the version. There was a breaking change in the Cake.Incubator v4.0.0 nuget package today which caused the issue https://www.nuget.org/packages/Cake.Incubator We have now pinned to the v3.1.0 to fix the issue

iamraghavs avatar Feb 27 '19 04:02 iamraghavs

@raghav710 thank you for replying again to this issue.

This is why we always recommend pinning to specific versions of both Cake and all addins/tools/modules, that you are using.

More information here:

https://cakebuild.net/docs/tutorials/pinning-cake-version

gep13 avatar Feb 27 '19 07:02 gep13