✅ Iteration through a list in csproj
I have a csproj file with a next section
This is how I pass environments
dotnet publish --configuration Release -p:Environments=sandbox;dev;qa;staging
It works correctly only for the first value from environments.
On the second iteration it shows me an error
I'm wondering how to make it work for the rest of the environments?
My package.json file contains all env-specific commands12 Replies
Based on the error message, I can assume that it tries to run
yarn run build:sandbox
as a first command.
Everything goes as expected with this command.
All further commands are:
dev
qa
staging
(without yarn run build:
)
And they are causing these errors.
Any idea why this happens?The whole log is here
https://pastebin.com/Tzqv8jK2
Pastebin
error message - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
if you can help it, move your build tasks away from msbuild
Nuke is probably your best option
It would be overkill for this project and task.
I can do something like this
But I want to keep environments configurable
I'm using a powershell
Holy cow
It's alive
Thank you @Retax, now it works
Once you have any logic in the build, I'd say Nuke is worth it
you've got quite a bunch already, it seems
trying to do things like this in MSBuild is just a tremendous waste of time, it doesn't report errors well and it's impossible to debug
I believe every word you say, but this task should have been done yesterday, so there is no time for that, unfortunately.
Oh shit, here we go again...
Now I'm trying to run this script in my Azure DevOps pipeline and I'm getting the same error.
It looks like the problem is still the same.
maybe quote the whole command idk
in the yaml file
it might be getting unescaped after having been parsed
Do you mean something like this?
I'm thinking to try bash instead of PowerShell in the pipeline
My bash task:
The output is the same.
So, I've played around with bash script and found that this version is working
The interesting thing is that in the end of the execution I'm getting an error.
Any idea why is this happening?
quirks
you could've integrated Nuke 5 times over at this point lol
Sorry, but it's still overkill in my case.
The problem was that I forgot about specifying the working directory.