dotnet / dotnet/project-system

Add documentation for usage of pre/post-build events from the Property Pages

Open
#8,845 0 comments 1 reaction 0 assignees View on GitHub
Documentation Feature-Project-Properties-Designer Triage-Approved
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

Based on this feedback item: https://developercommunity.visualstudio.com/t/Almost-impossible-to-use-post-build-even/10211397

It seems there is general confusion around the usage of pre-build and post-build events. In that feedback, the user calls the `powershell.exe` and issues individual PowerShell statements per call. It isn't a very efficient way to use this feature. We've also made it a bit harder to understand from a project-system side as now we collapse all lines into a single line in the `.csproj` file. This change was done [here](https://github.com/dotnet/project-system/pull/7119) to resolve issues accessing common MSBuild properties. For example, previously you'd have:
```xml

echo Line 1
echo Line 2
echo Line 3

```

Is now:
```xml

```

This becomes especially difficult to read for long scripts. We should clarify:
- How the script is executed
- What working directory it is executed in
- What is available (MSBuild properties, environment variables, etc.)
- Any other relevant information

I left a somewhat detailed explanation in the feedback item on the specific scenario the user was experiencing related to double-quotes and the PowerShell CLI. [Here](https://github.com/PowerShell/PowerShell/issues/11747) is a close-*ish* issue to what was experienced in the feedback from the PowerShell side of things.

Overall, determine if we can provide clarity on how to pre/post-build. I'm not sure if this is our team's responsibility or MSBuild or SDK or whomever, but it should be addressed somewhere.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.