New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context data can't handle data base class #4049
Comments
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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: