error MSB3073: reported by Visual Studio 2013 Post-build event - visual-studio-2013

I am using Visual Studio 2013 to run a suite of unit tests, which all pass.
If I run the tests as part of a post-build event they still pass but Visual Studio reports the following error:
Test Suite passed
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: The command "MinGW\msys\1.0\bin\bash run-test-suite.sh "TestSuiteName" test-dir Debug test-suite
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :VCEnd" exited with code -1.
Build FAILED.
Time Elapsed 00:00:00.92
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm at a loss as to why this is happening. I haven't been able to find any explanation of what can cause an exit code of -1.
One of the unit tests causes the class-under-test to throw an exception which it catches itself - i.e. it is not propagated to the test. While investigating the problem I noted that if I prevent the exception from being thrown the error goes away.

Related

Unable to get error logs from VS remote debug/deploy

I'm trying to deploy and debug my project on remote machine. My attempt to deploy and debug my code fails and Visual Studio provides me with following log:
1>------ Deploy started: Project: ProjectName, Configuration: Debug x64 ------
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Any ideas how I may get more output with some actual error codes?
Environment:
MSVS 2019 16.11.5
Verbosity level -- diagnostic both for build output and log file

Why outputting 'error: ' in Post-Build Event breaks my build in VS2012?

Adding
cmd.exe /c "ECHO error : unexplainable"
causes this:
1>------ Build started: Project: xxx, Configuration: Debug Win32 ------
1>EXEC : error : unexplainable
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(134,5): error MSB3073: The command "cmd.exe /c "ECHO error : unexplainable"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets(134,5): error MSB3073: :VCEnd" exited with code -1.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
It happens only when 'error' string is followed by a ':' character.
It is a bug in MSBuild: https://github.com/Microsoft/msbuild/issues/766
The 'Exec' task used by the 'PostBuildEvent' target should have the 'IgnoreStandardErrorWarningFormat' set to true by default but it doesn't, so it fails when finding 'error:' in the output.
An unreliable way to fix this is to modify the 'PostBuildEvent' target in
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppCommon.targets (at line 134) by adding IgnoreStandardErrorWarningFormat="true" to the 'Exec' task
Override predefined 'PostBuildEvent' in your project like here: Can I include a .targets file in a .props property sheet?

Why does my TeamCity build fail, eventhough MSBuild has no errors?

TeamCity is set up to build a Visual Studio solution, which can be build locally by a number of developers. However, when TeamCity runs the build, it will always fail the build, even though MSBuild outputs no errors:
[08:49:02][Step 1/1] Process exited with code 1
[08:49:02][Step 1/1] MSBuild output
[08:49:02][MSBuild output]
[08:49:02][MSBuild output] 183 Warning(s)
[08:49:02][MSBuild output] 0 Error(s)
[08:49:02][MSBuild output]
[08:49:02][MSBuild output] Time Elapsed 00:01:10.65
[08:49:03][Step 1/1] Step Build solution (Visual Studio (sln)) failed
For comparison, these are the last lines of build output in a local Visual Studio:
54>
54>Build succeeded.
54>
54>Time Elapsed 00:00:11.37
========== Rebuild All: 46 succeeded, 0 failed, 18 skipped ==========
The curious thing is, I cannot find a line which says "Process exited with code 1" locally. I have turned of all pre/post build events for each project. I've looked for possible culprits throughout the build log from TeamCity, but I cannot find any clue related to why it exits with code 1.
Interestingly, the build does produce the necessary artifacts, which are valid!
Why is my build exiting with code 1?
EDIT in response to comments:
Same version of msbuild
running msbuild on the server in command line, generate a build.log file with the same results "x warnings, 0 errors". echo %errorlevel% returns 0.
there is no settings to "Treat warnings as errors"
I'll try to post to complete output, but i need to anonymize it first.
I can think of 3 issues:
It looks like TeamCity fails the build step if warnings are encountered - can you check that is not the case?
As others have commented, please try to do an ms build from the command line. Have a look at the exact command line argumes Team city is invoking msbuild with.
There are settings in the projects themselves to "treat warning as errors" but then msbuild would obey those rules. Did you customize your build ? For more info see this.

build events for both release and debug mode

I have the following rule for post-build events
copy "$(TargetDir)$(TargetFileName)" ..\..\impld\
It works fine for release build but when I build in debug mode I get error
MSB3073: The command "
copy "< path to dll>" ..\..\impld\
:VCEnd" exited with code 1.
Problem is that though in debug mode < project_name>d.dll file is created VS still tries to copy "release" dll (without 'd'). There was no such error with VS2008, though the code was the same.

Visual Studio 2010 Web Deploy Error: Not allowed to begin a design-time build at this time for publish

I'm trying to publish an ASP.NET MVC 3 app but I am getting
------ Publish started: Project: MyProject, Configuration: Debug Any CPU ------
Not allowed to begin a design-time build at this time for publish. Please try again later.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
I've published before successfully ... I even tried restarting Visual Studio and then the whole PC!
Any thoughts?
I'm not sure why this fails, quite honestly, but I restarted VS 2010 like #Keven Coulombe suggested and after that the publish went through. My guess is this might happen after debugging other projects, and having VS open for extended periods (For me this was about one week).

Resources