Skip to content
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

Enable a debugMode switch #15

Open
9 of 13 tasks
sayedihashimi opened this issue Feb 2, 2014 · 2 comments
Open
9 of 13 tasks

Enable a debugMode switch #15

sayedihashimi opened this issue Feb 2, 2014 · 2 comments
Milestone

Comments

@sayedihashimi
Copy link
Member

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 to Invoke-MSBuild that will use the MSBuild APIs to invoke the build and then return the build result as well as resulting ProjectInstance.

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

  • Add -debugMode switch
  • Pass in properties during build
  • Pass in targets during build
  • Attach console logger
  • Attach file loggers
  • Pass in max node count
  • Ability to set toolsversion
  • Create a parameter set on Invoke-MSBuild
  • Create helper functions (Eval-Property/Eval-Item/Expand-String) that act on the last build result
  • Add evaluation functions to simplify
  • Eval-Property
  • Eval-Item
  • Eval-String
@sayedihashimi
Copy link
Member Author

Added related functionality via commit e63f4b2

@sayedihashimi
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant