Open sayedihashimi opened 10 years ago
Added related functionality via commit e63f4b2307ecf0c29291c5a47897553e3b678425
Now when you build you can pass in a new switch -debugMode
this will cause the build to be executed using the MSBuild APIs. After executing the build the result will be passed back to the caller. This will include a ProjectInstance
object which contains the project in the state when the build was completed.
PS> $bResult = Invoke-MSBuild .\temp.proj -debugMode
PS> $bResult.EvalProperty('someprop')
default
PS> $bResult.EvalItem('someitem')
temp.proj
PS> $bResult.ExpandString('$(someprop)')
default
PS> $bResult.ExpandString('@(someitem->''$(someprop)\%(Filename)%(Extension)'')')
default\temp.proj
You can get full access to the ProjectInstance object with the ProjectInstance property.
More functionality is available via the ProjectInstance object.
PS> $bResult.ProjectInstance.GetItems('someitem').EvaluatedInclude
temp.proj
You can get the BuildResuilt via the BuildResult parameter.
PS> $bResult.BuildResult.OverallResult
Failure
After building the project it would be nice if we could inspect the resulting project file. To facilitate this let's add a
-debugMode
switch toInvoke-MSBuild
that will use the MSBuild APIs to invoke the build and then return the build result as well as resultingProjectInstance
.Since we will be calling the APIs instead of the command line we may not be able to understand all the properties but known ones should be passed in.
Tasks