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.

 

 


Kunal Chowdhury

About the Author

Solution Architect & Former Microsoft MVP

Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.

He publishes technical and non-technical articles on .