How to put condition code in .ps1 files? #5653
Answered
by
GangWang01
StevenTCramer
asked this question in
Template authoring
-
I have read https://github.com/dotnet/templating/wiki/Conditional-processing-and-comment-syntax#other-file-types I am trying to conditionally include code based on the boolean $Env:ASPNETCORE_ENVIRONMENT = "Development"
Push-Location $PSScriptRoot
try {
#if(web)
Push-Location ./Source/ContainerApps/Web/Web.TypeScript
npm install
Pop-Location
#endif
Push-Location DevOps/Tye
tye run --dashboard --watch --logs console -v Debug
Pop-Location
}
finally {
Pop-Location
} |
Beta Was this translation helpful? Give feedback.
Answered by
GangWang01
Nov 22, 2022
Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
YuliiaKovalova
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.ps1
file is the case Other File Types. Note that the conditional expression should be prefixed with//
like below.