Is your Visual Studio instance returning error code MSB3073 while executing the post build event? If you faced such error message and already spent time on investigating the root cause, you came to a proper landing page.

 

Recently, I too faced it and later noticed the cause which I am going to document here to save your further investigation time. Hope that helps.

 

Visual Studio post build event returns error MSB3073 (www.kunal-chowdhury.com)

 

If you are using Visual Studio and encountered the following error “Visual Studio post build event returns error MSB3073” while executing commands written in the post build event section of any project, this could be due to invalid path.

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(4291,5): error MSB3073: The command 'if 'Release'=='Release' (

...

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(4291,5): error MSB3073: )' exited with code 9009. -- FAILED"

 

Recently, I encounter this error and after investing a lot of time on the analysis, I noticed that, I was using ‘xcopy’ command in one of the project and in the other one ‘SignTool’. Unfortunately, none of the commands were being picked up by the Visual Studio IDE while compiling the solution/project.

 

In case you are facing such issue, just put a absolute path of the commands that you are using inside the post build event and it will start working.

 

There could be other reason too. As I have already found this after a lot of investigation, sharing this to save your effort that I already put. Did this trick work? Please share your comments.

 

 

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.