cake-build / cake

:cake: Cake (C# Make) is a cross platform build automation system.
https://cakebuild.net
MIT License
3.85k stars 724 forks source link

Can't install dependencies to build a project #4116

Closed catap closed 1 year ago

catap commented 1 year ago

Prerequisites

Cake runner

Cake runner for .NET Framework

Cake version

1.3.0+Branch.main.Sha.c0364c3894c44e792c1be81b684c2215cd838c90

Operating system

macOS

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

Analyzing build script...
Analyzing /Users/catap/src/GeneticSharp/build.cake...
Processing build script...
Installing tools...
Installing addins...
Assemblies not found for tfm .NETFramework,Version=v4.6.1 and rid [NULL].
No assemblies found after running content resolver.
Error: Cake.Core.CakeException: Failed to install addin 'Cake.Sonar'.
  at Cake.Core.Scripting.ScriptProcessor.InstallAddins (System.Collections.Generic.IReadOnlyCollection`1[T] addins, Cake.Core.IO.DirectoryPath installPath) [0x000c0] in <040622b6758f456b89fd2a5b24e3e64c>:0 
  at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath) [0x0013b] in <040622b6758f456b89fd2a5b24e3e64c>:0 
  at Cake.Features.Building.BuildFeature.RunCore (Spectre.Console.Cli.IRemainingArguments arguments, Cake.Features.Building.BuildFeatureSettings settings) [0x0010d] in <21a7d41a88904b88a0986b85ed354c53>:0 
  at Cake.Features.Building.BuildFeature.Run (Spectre.Console.Cli.IRemainingArguments arguments, Cake.Features.Building.BuildFeatureSettings settings) [0x00012] in <21a7d41a88904b88a0986b85ed354c53>:0 
  at Cake.Commands.DefaultCommand.Execute (Spectre.Console.Cli.CommandContext context, Cake.Commands.DefaultCommandSettings settings) [0x000d0] in <21a7d41a88904b88a0986b85ed354c53>:0 

What is expected?

To work

Steps to Reproduce

  1. git clone https://github.com/giacomelli/GeneticSharp.git
  2. cd GeneticSharp
  3. curl -Lsfo build.sh https://raw.githubusercontent.com/cake-build/resources/master/dotnet-framework/build.sh
  4. chmod +x build.sh
  5. ./build.sh -- -v Diagnostic

Output log

No response

devlead commented 1 year ago

Cake.Sonar 1.1.32 targets new version of Cake and only net6.0 / net7.0

image https://nuget.info/packages/Cake.Sonar/1.1.31

The latest version that supports .NET Framework is 1.1.26 image https://nuget.info/packages/Cake.Sonar/1.1.26

Best option would be to if possible to upgrade to latest version of Cake.Tool (3.0) which target .NET 6 & 7, other option would be to in your build.cake pin to older versions of addins and tools that target .NET Framework.

catap commented 1 year ago

@devlead may you suggest a way to update Cake.Tool?

catap commented 1 year ago

Ah, I see. I'm getting Cake from https://cakebuild.net/download/bootstrapper/packages and 1.3.0 is suggested here :)

devlead commented 1 year ago

I would suggest doing something like https://github.com/giacomelli/GeneticSharp/compare/master...devlead:GeneticSharp:feature/caketool

Then it's just

  1. git clone https://github.com/giacomelli/GeneticSharp.git
  2. cd GeneticSharp
  3. dotnet tool restore
  4. dotnet cake

similar to described here https://cakebuild.net/docs/getting-started/setting-up-a-new-scripting-project

The old bootstrappers are no longer needed.

Looks the the AppVeyor build already utilize Cake.Tool

https://github.com/giacomelli/GeneticSharp/blob/e15ee828db3663bcdd0362b5e18620bedf220384/appveyor.yml#L17

catap commented 1 year ago

Thanks, it works!

augustoproiete commented 1 year ago

Moving to Discussions - https://github.com/cake-build/cake/discussions