Starting in version v0.34.0, this addin directive no longer works:
``
``
That command results in the error:
Error: Failed to install addin 'DiscUtils.Iso9660'
This is the only nuget based addin I am using, so I didn't try with others. But, this command works in v0.33.0, so I assume it is caused by changes in v34 and above...
In v0.33.0, the addin is installed as expected.
v0.34.0
64
Windows
Yes, TeamCity
Run build.ps1
Module directory does not exist.
NuGet Config not specified. Will use NuGet default mechanism for resolving it.
Analyzing build script...
Analyzing C:/BuildAgent/work/5ab8edbab21055b3/build.cake...
Analyzing C:/BuildAgent/work/5ab8edbab21055b3/tools/redacted/redacted/redacted.cake...
Processing build script...
Installing addins...
The 'addin' directive is attempting to install the 'Cake.Powershell' package
without specifying a package version number.
More information on this can be found at https://cakebuild.net/docs/tutorials/pinning-cake-version
It's not recommended, but you can explicitly override this warning
by configuring the Skip Package Version Check setting to true
(i.e. command line parameter "--settings_skippackageversioncheck=true",
environment variable "CAKE_SETTINGS_SKIPPACKAGEVERSIONCHECK=true",
read more about configuration at https://cakebuild.net/docs/fundamentals/configuration)
GET https://api.nuget.org/v3/registration3-gz-semver2/cake.powershell/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/cake.powershell/index.json 233ms
The addin Cake.Powershell will reference Cake.Powershell.dll.
The addin Cake.Powershell will reference System.Management.Automation.dll.
The log ends here, but the following stacktrace is output to the console:
Error: Cake.Core.CakeException: Failed to install addin 'DiscUtils.Iso9660'.
at Cake.Core.Scripting.ScriptProcessor.InstallAddins(IReadOnlyCollection`1 addins, DirectoryPath installPath)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
Try adding &prereleae
https://cakebuild.net/docs/fundamentals/preprocessor-directives
Thanks @devlead - that does solve the issue and it makes sense given the alpha version of the addin.
However, I will probably opt for pinning v0.33.0 so I don't have to rev the version of our common cake script that contains this #addin directive.
Could you provide any background on why this works in earlier versions and not in v34 and beyond? Again, makes sense to me, but changing behavior should be noted somewhere in the Cake docs...
I Just ran into this as well and its a breaking change that was not disclosed in version 0.34.0.
It appears that even if you specify the version if you don't also specify prerelease it won't install the package. So if you specify a prerelease version like 0.3.0-dev0070 the tool will ignore it and not install the package unless its says prerelease.
This affects all preprocessor directives scripts, addins, and tools. The correct usage of the prerelease tag is if you don't specify version and want the directive to install latest even if its prerelease. If you specify version it should always install that version of package if that version exists.
This has been fixed via https://github.com/cake-build/cake/issues/2595 and will be available in Cake v1.0.0 RTM.
You can test it today with the release candidate Cake v1.0.0-rc0002.
@augustoproiete is this a duplicate of #2595? If so, I think we should add the Duplicate label, or we should assign this issue to the 1.0.0 milestone.
Thanks for the reminder @gep13. I've added the Duplicate label on this one to simplify.
_Technically #2595 is a duplicate of this one (which came first) but it has more discussions, PR associated, and is in the milestone already_.
Most helpful comment
I Just ran into this as well and its a breaking change that was not disclosed in version 0.34.0.
It appears that even if you specify the version if you don't also specify prerelease it won't install the package. So if you specify a prerelease version like
0.3.0-dev0070the tool will ignore it and not install the package unless its says prerelease.This affects all preprocessor directives scripts, addins, and tools. The correct usage of the prerelease tag is if you don't specify version and want the directive to install latest even if its prerelease. If you specify version it should always install that version of package if that version exists.