0

As stated in the title, all pre-build events exit with code 1. I was originally using 'git describe --tags > "$(OutputDir)version.txt"', but I have changed the command here to show that even a simple 'echo' command is failing. I have attempted to repair the installation, but no luck. The diagnostic output does not give any clear details. I am running Visual Studio 2019 Version 16.11.5.

Error Message:

Error   MSB3073 The command "echo" exited with code 1.  

Diagnostic Output:

1>Target "PreBuild" in file "C:\Apps\Development\captain\Cadet\Cadet.csproj":
1>  Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>  Task "Exec"
1>    Task Parameter:Command=echo
1>    echo
1>    C:\Apps\Development\captain\Cadet\Cadet.csproj(27,5): error MSB3073: The command "echo" exited with code 1.
1>  Done executing task "Exec" -- FAILED.
1>Done building target "PreBuild" in project "Cadet.csproj" -- FAILED.

Pre-Build Event in .csproj

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
  <Exec Command="echo" />
</Target>
oSiv
  • 26
  • 4
  • 1
    [Please do not upload images of code/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Ken White Nov 11 '21 at 17:34
  • 1
    That is an odd prebuild event, but seems to be designed to diagnose the exact problem you're having. Look through source control, talk to team members. My guess is that the TEMP environment variable is corrupted. – Hans Passant Nov 11 '21 at 18:14
  • You're correct. My original pre-build event is "git describe --tags > "$(ProjectDir)version.txt". I changed this to a simple "echo" to indicate that any command I attempt to run in the pre/post build events will fail with exit code 1. Thanks for the tip on the TEMP env variable. – oSiv Nov 11 '21 at 18:34
  • Looking closer at the diagnostic output, it looks like my TEMP variable is correct: 1>TEMP = C:\Users\\AppData\Local\Temp – oSiv Nov 11 '21 at 18:40

0 Answers0