TopShelf MSDeploy Install Exit Code On Error - msbuild

I'm trying to install a service using TopShelf from CI. However whenever an exception occurs during installation, TopShelf rollsback the transaction and continues with the build process, returning a 0x0 status.
This means that as far as the CI server is concerned, the deployment was successful.
An example of the command I'm using in MSBuild is:
<Message Text ="Installing Service" />
<Exec Command=""$(MSDeployPath)" -verb:sync -source:runCommand="$(RemoteServicePath) install /instance:$(DeployEnvironment)",dontUseCommandExe=false,waitAttempts=10,waitInterval=10000 -dest:auto,computername=%(ComputerName) -verbose -retryInterval:10000 -retryAttempts:10"></Exec>
The output I receive is:
[Exec] Running a transacted installation. <br>
[Exec] <br>
[Exec] Verbose: Received response from agent (HTTP status 'OK'). <br>
[Exec] Info: <br>
[Exec] Beginning the Install phase of the installation. <br>
[Exec] <br>
[Exec] Info: Installing service Foo...<br>
[Exec] <br>
[Exec] Info: Creating EventLog source Foo in log Application...<br>
[Exec] <br>
[Exec] Info: <br>
[Exec] An exception occurred during the Install phase.<br>
[Exec] <br>
[Exec] Info: System.ComponentModel.Win32Exception: The specified service already exists<br>
[Exec] <br>
[Exec] The Rollback phase of the installation is beginning.<br>
[Exec] Restoring event log to previous state for source Foo.<br>
[Exec] <br>
[Exec] The Rollback phase completed successfully.<br>
[Exec] <br>
[Exec] The transacted install has completed.<br>
Any ideas how I can make the build fail on the exception?

The latest release of Topshelf (3.0.2) added a TopshelfExitCode, which is an enum that can be cast to an (int) and returned from Main in your console application.
If install/uninstall fails, the error code is non-zero (the enumeration has all the possible values). So now it should play nicely with batch files/builds expecting non-zero exit codes when things don't install properly.

Related

can't start rabbitmq-server after installation on windows

I try to run this 'rabbitmq-server' command in my cmd but that give me this error ...
Configuring logger redirection
13:44:01.865 [warning] Using RABBITMQ_ADVANCED_CONFIG_FILE: c:/Users/saikat/AppData/Roaming/RabbitMQ/advanced.config
13:44:02.838 [error]
13:44:02.838 [error] BOOT FAILED
BOOT FAILED
13:44:02.838 [error] ===========
===========
13:44:02.838 [error] ERROR: distribution port 25672 in use by another node: rabbit#DESKTOP-1I7H1RC
ERROR: distribution port 25672 in use by another node: rabbit#DESKTOP-1I7H1RC
13:44:02.838 [error]
13:44:03.839 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"} in context start_error
13:44:03.840 [error] CRASH REPORT Process <0.152.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"DESKTOP-1I7H1RC\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","DESKTOP-1I7H1RC"}}},{r
Crash dump is being written to erl_crash.dump...done
No doubt you have already resolved this, but for anyone else this may help I had the same issue on Windows and managed to resolve it by doing the followed.
Open powershell as admin in *\rabbitmq_server-3.8.9\sbin*
Stop the service by running: .\rabbitmq-service.bat stop
Start the service by running: .\rabbitmq-server.bat
If you are on windows then go to Services
Search RabbitMq and Right click
Stop service
Open cmd as administrator
run cd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.17\sbin
and then run rabbitmq-server
For me what I did was killing the process of erl from the task manager and then running the command:
rabbitmq-server.bat

SQL Build Task :error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException

I am not getting any Errors when i Build the Project in My Solution File,but when it was about to Deploy in Testing Environment it says below Error.
What could be the Reasons and How to avoid this in Future.
**error MSB4018: The "SqlBuildTask" task failed unexpectedly.
[msbuild] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(550,5): error MSB4018: Microsoft.Isam.Esent.Interop.EsentVersionStoreOutOfMemoryException: Version store out of memory (cleanup already attempted)
**

Install Qutip on Mac os x 10.10 via MacPorts

I am not sure whether i can ask this question here.
I tried to install QuTips on my mac osx 10.10. Am following these two documentation for installation Qutip and MacPorts. Now am struggle to install gcc49.
When i execute this command sudo port install py34-scipy I got the following error
Admins-iMac-2:base admin$ sudo port install py27-scipy
---> Computing dependencies for py27-scipy
The following dependencies will be installed:
gcc49
py27-numpy
swig
swig-python
Continue? [Y/n]: y
---> Building gcc49
Error: Failed to build gcc49: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/main.log for details.
Error: Follow http://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port py27-scipy failed
Admins-iMac-2:base admin$ sudo port install py34-numpy
---> Computing dependencies for py34-numpy
The following dependencies will be installed: gcc49
Continue? [Y/n]: y
---> Building gcc49
Error: Failed to build gcc49: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/main.log for details.
Error: Follow http://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port py34-numpy failed
Admins-iMac-2:base admin$ vi /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/main.log
Admins-iMac-2:base admin$
I go and look for main.log file. At the end of this file i got below errors
:info:build gcc/vtable-verify.o differs
:info:build make[2]: *** [compare] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/work/build'
:info:build make[1]: *** [stage3-bubble] Error 2
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/work/build'
:info:build make: *** [bootstrap] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/work/build'
:info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/work/build" && /usr/bin/make -j4 -w bootstrap
:info:build Exit code: 2
:error:build Failed to build gcc49: command execution failed
:debug:build Error code: CHILDSTATUS 2595 2
:debug:build Backtrace: command execution failed
:debug:build while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build invoked from within
:debug:build "command_exec build"
:debug:build (procedure "portbuild::build_main" line 8)
:debug:build invoked from within
:debug:build "$procedure $targetname"
:debug:build Registry error: gcc49 not registered as installed & active.
:debug:build invoked from within
:debug:build "registry_active $subport"
:debug:build invoked from within
:debug:build "$workername eval registry_active \$subport"
:error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/main.log for details.
Am not familiar with this. I cannot complete installation without this gcc49. Alternatively i install gcc48, but dosen't work for me. Every time it automatically tried ti install gcc49.
Anybody have any suggestion, it will be really appreciated.
I can answer my question
run sudo port clean gcc49, then try again

Error in creating Jitsi windows Installer following http://stackoverflow.com/questions/14495465/installer-for-jitsi-sip-communicator/22658530#22658530

I am trying to make Jitsi installer, following
Installer for Jitsi SIP Communicator
but facing following error
wix-sign-file:
[exec] setup.msi: 52.3 MiB / 199.0 MiB = 0.263, 1.2 MiB/s, 2:44
[exec] process_begin: CreateProcess(NULL, rm.exe -f ../../../../resources/install/windows/config.h, ...) failed.rm.exe -f ../../../../resources/install/windows/config.h
[exec]
[exec] make (e=2): The system cannot find the file specified.Makefile:69: recipe for target 'E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.h' failed
[exec]
[exec] echo #define PRODUCTNAME "Jitsi" > E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.hmake.exe: [E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.h] Error 2 (ignored)
[exec]
[exec] echo #undef PACKAGECODE >> E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.h
[exec] echo #undef PACKAGESIZE >> E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.h
[exec] echo #define PRODUCTBUILDVERSION "1.1.0.9" >> E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/config.h
[exec] C:/mingw/bin/windres.exe -I../../../../resources/install/windows -IE:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp setup.rc -O coff -o E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/setup.res
[exec] 'C:' is not recognized as an internal or external command,
[exec] operable program or batch file.
[exec] 'C:' is not recognized as an internal or external command,
[exec] operable program or batch file.
[exec] C:/mingw/bin/gcc.exe -O2 -Wall -Wreturn-type -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 -IE:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp -DBSPATCH_API_STATIC -DBZ2_API_STATIC -I. -IC:\MinGW\bzip2/include -IC:\MinGW\bzip2 -DLZMA_API_STATIC -IC:\MinGW\xz/include -IC:\MinGW\xz/api -I../run bspatch.c lasterror.c nls.c ../run/registry.c setup.c E:\JZ\Code\JavaCode
\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/setup.res -mwindows -LC:\MinGW\bzip2/lib/ -LC:\MinGW\bzip2 -LC:\MinGW\xz/lib/ -LC:\MinGW\xz/.libs -o E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/setup.exe -ladvapi32 -lbz2 -llzma -lole32 -lshell32
[exec] Makefile:63: recipe for target 'E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/setup.exe' failed
[exec] c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -llzma
[exec] collect2.exe: error: ld returned 1 exit status
[exec] make.exe: *** [E:\JZ\Code\JavaCode\jitsilatest\LANJr4D-jitsi-b56f30acd2d1/release/windows/tmp/setup.exe] Error 1
BUILD FAILED
Although i have xz package in C:/MingW/xz and also set the environment variable for it LZMA_HOME
Thanks
JZ
For this error you have to have /src/native/windows/setup in your PATH. Then copy either /src/native/windows/setup/lib/x64/libbz2.a or /src/native/windows/setup/lib/x86/libbz2.a and libllzma.a files into /src/native/windows/setup/lib. Remove all other path and system variable references to bzip2 and lzma. You do not need xz or bzip2 anymore since the files are included at the above location and the xz.exe executable is included at /resources/install/windows. If you use the external bzip2 like all the internet instructions say, you will get bzip2.dll errors when you finally do manage to make the installer and try run the executable.
All the instructions on the internet are obsolete/wrong. All of them. Every single one! NOBODY has bothered to point this out anywhere. NOBODY. You will not even find any info in the dev or user mail lists. Only little breadcrumbs of current info here and there. I had to figure this little gem out on my own. Took me several days. Fun times.
This isn't the only wrong thing in all the instructions. I am still working through them all. Once I get a perfect install I'll try add updated instructions somewhere.
I can get it to compile but the executable will crash. If I use 64bit Java on the 32bit executable then I can get it to run. So there is still something wrong with the C wrapper. No information anywhere. Everyone who has posted the same problem has not had any response and are all in the same boat.

NUnit 2.4.6 unable to find log4n 1.2.10 when launched from NAnt 0.91-alpha2

I have a .NET 3.5 web application, and I am adding Silverlight 4. I can build and test the whole project in VS 2010. My assemblies still targets 3.5. I had to upgrade NAnt from .85 to .91-alpha2 to get the build to work at all, and I had to use an call to msbuild v4.0.30319 rather than NAnt's task. That all works now (though if anybody has suggestions for improvement, I'm open to them).
After the build, NAnt launches unit tests. My problem is that it immediately fails because NUnit can't find the right log4n.dll. The output is below (elipses added to obfuscate some folder names). NAnt uses log4n 1.2.9, and NUnit uses 1.2.10. Each application has the correct version in its install directory. NAnt loads its version, which is in use when it launches NUnit, but I don't see why there is a conflict. I suspect the problem has something to do with NAnt .91-alpha2, and I can't think of a work-around.
[exec] Unhandled Exception:
[exec] System.TypeInitializationException: The type initializer for 'NUnit.Core.RemoteTestRunner' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
or one of its dependencies. The system cannot find the file specified.
[exec] File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
[exec] at NUnit.Core.RemoteTestRunner..cctor()
[exec]
[exec] Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
[exec] Running under executable C:\Program Files\NUnit 2.4.6\bin\nunit-console.exe
[exec] --- A detailed error log follows.
[exec]
[exec] === Pre-bind state information ===
[exec] LOG: User = ...
[exec] LOG: DisplayName = log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
[exec] (Fully-specified)
[exec] LOG: Appbase = file:///c:/AutomatedBuild/sourcecode/.../bin/Debug
[exec] LOG: Initial PrivatePath = NULL
[exec] Calling assembly : nunit.core, Version=2.4.6.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77.
[exec] ===
[exec] LOG: This bind starts in default load context.
[exec] LOG: No application configuration file found.
[exec] LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
[exec] LOG: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
[exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net.DLL.
[exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net/log4net.DLL.
[exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net.EXE.
[exec] LOG: Attempting download of new URL file:///c:/AutomatedBuild/sourcecode/.../bin/Debug/log4net/log4net.EXE.
[exec]
[exec] --- End of inner exception stack trace ---
According the OP, the error was resolved by updating NUnit:
NUnit 2.4.6 was broken by something I installed, because I get the error when I run the NUnit GUI alone. I do not get the error on a new version I installed (2.5.7).