MSBuild error MSB3073

Problem:

Building project with console MSBuild sometimes causes an Error MSB3073: The command exited with code 1.

For example, simple exec msbuild task fails:

<exec Command=”echo HelloWorldMessage” />

This appears at msbuild.exe output as:

‘C:\Documents’ is not recognized as an internal or external command,  operable program or batch file.

MSBuild wraps your command with a temporary bat file and stores it to the user Temp directory.  Then MSBuild tries to execute your bat file with CMD. Usually, user Temp directory path starts with ‘C:\Documents and Settings\UserName’.  So, first command CMD interpretation looks like ‘C:\Documents’.

Solution:

  1. Go to environment variables menu.
  2. Change TEMP and TMP variables to the values without spaces. For example, ‘C:\Temp’.
  3. Create new temp directory ‘C:\Temp’.
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a comment