Is there some way to access the value of an MSBuild property from a custom task?
I know I can send them all in, but it would be nice not to :) I am trying to do this from a TFS build.
Or is there some way to access the "build script" currently running? Maybe like an object model and from there get what I need?
This should do the job.
public override bool Execute()
{
string projectFile = BuildEngine.ProjectFileOfTaskNode;
Engine buildEngine = new Engine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory());
Project project = new Project(buildEngine);
project.Load(projectFile);
foreach(var o in project.EvaluatedProperties)
{
// Use properties
}
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With