Reputation: 539
Can you get property set by MSBuild inside your cake script?
I currently have a target that runs after compilation to indicate whether it has run, or whether it was an incremental build.
I want to detect in the remainder of my cake build whether incremental build took place.
The target that I currently use on my MSBuild is as follows:
<!-- Defines Targets that should be run after Compile, but skipped if Compile doesn't take place -->
<PropertyGroup>
<TargetsTriggeredByCompilation>
$(TargetsTriggeredByCompilation);
EnablePostBuild
</TargetsTriggeredByCompilation>
</PropertyGroup>
<Target Name="EnablePostBuild">
<!-- Disable post build actions -->
<PropertyGroup>
<SkipPostBuildActions>false</SkipPostBuildActions>
</PropertyGroup>
</Target>
If I trigger the build in Cake as follows:
var buildSettings = new MSBuildSettings()
.WithProperty("SkipPostBuildActions", "true")
MSBuild("./src/Application.sln",buildSettings );
var SkipPostBuildActionsVal = buildSettings??
Can I get the value of SkipPostBuildActions after the MSBuild step?
Upvotes: 0
Views: 451
Reputation: 9941
This is actually not much of a Cake problem: Cake "only" runs msbuild using the given parameters.
So, if you find a way how to access a Property
from outside msbuild you can transfer that solution to Cake.
AFAIK msbuild does not even support easy sharing of property-modifications between tasks, let alone outside the msbuild-process.
I see two possible solutions:
SkipPostBuildActions
into the log, using the Message
-Task then set a FileLogger
on your msbuild-call and parse the log-file afterwards.SkipPostBuildActions
to a dedicated file using the WriteLinesToFile
-Task then parse that file after msbuild has run.Personally I'd chose the latter option.
Upvotes: 1