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

Add an option to set the "cake.exe" absolute or relative path #79

Closed olirich closed 3 years ago

olirich commented 6 years ago

It seems that Cake for Visual Studio is looking for "Cake.exe" either in the solution folder or in the PATH environment variable. If not found, Visual Studio gives the status bar message : "Could not find Cake.exe in the local folder or in the PATH". The standard use case for Cake is to use the build.ps1 bootstrapper script to install the Cake tool with its dependencies beside the solution.

I have another use case : my repository contains many solutions, and add the full Cake tool with dependencies to all the solutions would be overkill. So I would like to add a full version of Cake (with its dependencies) to my repository, in a common path above all my solutions, to be able to use it directly when pulling the repository (without adding it to the PATH).

This use case works with a script using build.cake and cake.config files, but doesn't work with Cake for Visual Studio since it can't find Cake.exe. So providing an option to set the Cake.exe path (absolute or relative to build.cake or the solution file) would be highly beneficial in this use case.

wojciechrak commented 6 years ago

I am voting for this, too. In our case, we already had a path /tools in our repository, so we put Cake in /cake/tools instead.

sbakharev commented 5 years ago

Hello! The problem is still in place and we're interested in this feature too.

We renamed the Cake's tools folders to ".build-tools" in build.ps1 for it to be alphabetically standing before the solution projects' folders instead of appearing somewhere in the middle.

So the script placed all tools to ./.build-tools/ and Cake itself to ./.build-tools/Cake/Cake.exe. With this setup in place Cake extension for Visual Studio cannot find Cake.exe and thus cannot show build.cake tasks in task runner explorer.

What I see using Process Monitor is that Visual Studio tries to find Cake.exe at:

So the first path it uses means that "tools" directory name is hardcoded and thus required for the extension to function properly. We definitely need an option to control this.

P.S. Modifying cake.config file to use ./.build-tools as tools path does not change anything.

agc93 commented 5 years ago

Thanks everyone for all the feedback. I know this has been a very long time coming, but I've been revisiting a few of these long-term pain points of late and wanted to let you know what's happening.

I understand that this is frustrating behaviour but a lot of our options are either difficult to achieve in the VS environment or have other issues that we would then need to fix again.

My current intention is to at least have the extension respect the "Tools Path" from cake.config and search that path for cake.exe. We might be able to improve on that in future though, so I'll keep looking into this.

Thanks for your patience!

agc93 commented 5 years ago

I've now added experimental support for using cake.config for this. The extension will now try to resolve cake.exe from the following locations (in this order):

If you're using the prerelease version of the extension, it should automatically pick up cake.exe from any of the locations above. We'll look into improving this behaviour even more going forward.

If anyone is still facing this issue, can you please try out the prerelease version and let me know if it solves your issue.

gep13 commented 3 years ago

I believe that this now works as expected, so going to go ahead and close this out.