cake-build / cake-vs

Cake Extension for Visual Studio
https://marketplace.visualstudio.com/items?itemName=vs-publisher-1392591.CakeforVisualStudio
MIT License
67 stars 25 forks source link

Cake Tasks in a Solution Folder aren't listed in the Task Runner Explorer #80

Closed ravindUwU closed 6 years ago

ravindUwU commented 6 years ago

I've got a .NET Standard class library project with the following structure,

src/
│
├───Cake/
│   ├───tools/
│   ├───build.cake
│   ├───build.ps1
│   └───cake.config
│
├───Project/
│   └───Project.csproj
│
├───Project.Tests/
│   └───Project.Tests.csproj
│
└───Project.sln

The Cake build scripts located within the src/Cake/ folder are added to the Project.sln solution within a Solution Folder (right click solution -> Add -> New Solution Folder), so that the Solution Explorer shows this (I've redacted some information),

Solution Explorer

With this project layout, the Task Runner Explorer doesn't list the tasks declared in build.cake.

Task Runner Explorer

gep13 commented 6 years ago

@RavinduL unfortunately, you are running into a known limitation of Visual Studio. This is detailed in this issue:

https://github.com/cake-build/cake-vs/issues/30#issuecomment-251945464

I am going to close this as it is a duplicate of the other.

ravindUwU commented 6 years ago

Thanks for your prompt reply @gep13. @agc93's solution worked perfectly...

I resolved this by adding two files, build.cake and cake.config to the root of the Project.

build.cake contained,

#load "../Cake/build.cake"

cake.config contained,

[Paths]
Tools=../Cake/tools

The Task Runner Explorer now lists the tasks within src/Cake/build.cake, and runs them using the tools directory within the same folder, as it would've done if the Cake script was run via build.ps1.

gep13 commented 6 years ago

@RavinduL glad to hear that you got this working! Thanks for reporting back!