Open McDoit opened 1 year ago
This is by design, you can register multiple types by running Setup multiple with different types, if base type was registered this wouldn't be possible.
But you could opt-in to register your base type, i.e. something like below
internal abstract class BaseCake
{
public FilePath SolutionFile { get; set; }
}
var buildTask = Task("Build")
.Does<BaseCake>(bc =>
{
var settings = new DotNetBuildSettings
{
Configuration = "Debug"
};
DotNetBuild(bc.SolutionFile.FullPath, settings);
});
internal class PackageCake : BaseCake
{
}
{
var pc = new PackageCake{
SolutionFile = "MySolution.sln"
};//code
Setup(ctx => pc);
Setup<BaseCake>(ctx => pc);
}
var packTask = Task("Pack")
.IsDependentOn(buildTask)
.Does<PackageCake>(pc =>
{
//code
});
RunTarget("Pack");
Prerequisites
Cake runner
Cake .NET Tool
Cake version
2.3.0
Operating system
Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
I'm experimenting a bit with multi-layered cake files Currently working on putting all the base building/testing in a single cake file, and use that for more specific packing tasks in other files Running inhertiance between the setuped implementation and an abstract base class in the base cake file gives the following error
That seems to indicate that it doesn't consider or support reading context data based on inherited classes?
What is expected?
To be able to use data in a base class, in
Does
calls typed to the baseclassSteps to Reproduce
Base.cake file:
Pacakge.cake
This will casue the Package.cake to fail with
Output log
No response