Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a powershell script which I am invoking from <target name="BeforeBuild"> in .csproj file using Task <exec>.

I am returning error and error text from Powershell script if a check in the script fails.

Basically, I am failing the build if powershell script returns error and error is written under Error List in Visual Studio during build.

What I don't want on error list is another error which says that this powershell script has failed in EXEC task.
e.g.
This Command has failed in <exec command="powershell.exe -command commandfile.ps1">

Is there any way that this error will not display if an error is returned from the script???
But I do want the error still displayed from commandfile.ps1, if any.


Thanks

What I have tried:

I did try IgnoreStandardErrorWarningFormat = "false" but it also stops the errors from script being displayed.
Posted
Updated 4-May-16 0:29am
Comments
CHill60 5-May-16 6:42am    
Note to other members - I have deleted the solution I offered which was related to the ContinueOnError attribute.
OP response " tried this.
But I do want the errors emiited from the powershell script and fail the build right away which is anyways the default and I don't need to set ContinueOnErrror flag for that.

What I don't want is the additional error appearing in the error list displaying on which line and which task in .csproj did the build fail."

So I'm dropping this back into the unanswered questions queue.
@itsgood123 ... the obvious response to your question is probably going to be "why"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900