I am trying to create an MSI through Microsofts visual studio installer project. Everything is working fine except for my "PostBuildEvent" I am trying to modify the Userinit string located "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" in my post-build event I have
REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /f
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d C:\Windows\system32\MyApp.exe, /f
This doesn't appear to be working, Would anyone have any ideas on how I can modify this String value with the MSI?
Related
When running MSBuild via Jenkins, the build fails at the signing process as follows:
C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\Build-EngineeringApps.proj(178,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe" sign /v /f "C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\certificate.pfx" /p [Password redacted] /t "http://timestamp.verisign.com/scripts/timstamp.dll" "C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\Setup\Release\setup.exe"" exited with code 255.
Running MSBuild from the developer command prompt is successful. Running the above command from the command prompt is also successful.
If the timeserver is removed from the command, Jenkins builds successfully. i.e.
C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\Build-EngineeringApps.proj(178,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool.exe" sign /v /f "C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\certificate.pfx" /p [Password redacted] "C:\Program Files (x86)\Jenkins\workspace\engsoft\eng-software\Setup\Release\setup.exe"" exited with code 255.
The jenkins service is configured to run under the administrator account. This is the same account that can successfully build via MSBuild as above. The certificate has been added to the store under this user also.
I'm currently trying to set up a build process on a build server and I'm having some trouble installing JEDI with MSBuild. I'm using the Delphi XE2 compiler and based on this Stackoverflow thread I have created the following batch file that I use.
#echo off
:::
:::Build Delphi Project with MSBuild
:::
echo.
echo Setting up Delphi XE2 environment
echo.
SET BDS=C:\DelphiXE2
SET BDSBIN=%BDS%\bin
SET BDSLIB=%BDS%\lib
SET BDSTMP=%BDS%\temp
SET BDSAPPDATA=%APPDATA%\Embarcadero\BDS\9.0
IF NOT EXIST "%BDSAPPDATA%" MKDIR "%BDSAPPDATA%"
COPY /Y /B /V "%BDSTMP%\EnvOptions.proj" "%BDSAPPDATA%\EnvOptions.proj"
echo.
echo Build Delphi Project with MSBuild from Visual Studio 2017
echo.
SET MSBUILD_EXE=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
"%MSBUILD_EXE%" %1 /t:%~2 /p:Config=%~3;Platform=%~4
I then call
compile.bat ".\Jedi\JCL\packages\JclPackagesD160.groupproj" "Clean;Build"
which works fine (atleast without any errors) and after that
compile.bat ".\Jedi\JVCL\packages\D16 Packages.groupproj" "Clean;Build"
But the second call fails because jedi/jedi.inc can not be found. What am I doing wrong?
Check the .dproj file(s). Is the subdirectory containing the jedi.inc file included in the search path? Is the file actually there? (It used to be in its own svn repository on sourceforge and included as an svn:external. No idea how they have solved this with git nowadays.)
I am trying to build a delphi project in TeamCity, but I can't get it to work.
I'm using MSBuild to build the project and also have added BDS parameter to the build but I keep getting the error: MSB4040 There is no target in the project.
There are several things you need to be aware of. Firstly, the various environment variables and paths that Delphi requires need to be setup. Much of this is accomplished by the rsvars.bat batch file, but you can set up your own. Secondly, your EnvOptions.proj file needs to be set correctly to match the environment on your build machine. This file resides in %APPDATA%\Embarcadero\xx,x\ where xx.x is your Delphi version.
The following commented CMD file is one that I use to build Delphi XE7 applications in a TFS environment and should work with TeamCity and other build tools :-
#echo off
:::
::: Example for Build Delphi Project with MSBuild
:::
echo.
echo using MSBuild from VStudio 2013
echo.
SET MSBUILD_EXE=C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe
echo.
echo A copy of a Delphi installation from a developers machine is ok. MSBuild calls dcc32/dcc64, not the IDE.
echo The build targets are included in "$(DelphiInstallDir)\bin\CodeGear.Delphi.Targets".
echo DefaultTarget is "Make"
echo.
echo.
echo Set Delphi XE7 Vars
echo.
SET BDS=C:\DelphiXE7
SET BDSBIN=%BDS%\bin
SET BDSLIB=%BDS%\lib
SET BDSTMP=%BDS%\Temp
echo.
echo On a local Delphi developer machine the actual used Delphi settings are located here:
echo "%APPDATA%\Embarcadero\BDS\15.0\EnvOptions.proj"
echo.
echo The directories and files included in "EnvOptions.proj" must exist on the build machine!!!
echo.
echo Copy the (maybe modified) Delphi settings on your build machine to %APPDATA%\Embarcadero\BDS\15.0
echo.
MKDIR "%APPDATA%\Embarcadero\BDS\15.0"
COPY /Y /B /V "%BDSTMP%\EnvOptions.proj" "%APPDATA%\Embarcadero\BDS\15.0\EnvOptions.proj"
echo.
echo Set the Delphi Project Vars
echo.
SET PROJECT_SRC=C:\MyProjectSource
SET PLATFORM=Win32
SET CONFIG=Debug
echo.
echo Build Delphi Project with MSBuild
echo.
echo + /p = Parameters for the Delphi Project Build
echo.
echo + /t = Targets to be executed, e.g. Clean and Build
echo.
"%MSBUILD_EXE%" "%PROJECT_SRC%\myProject\myProject1.dproj" /p:Config=%CONFIG%;Platform=%PLATFORM% /t:Clean;Build
IF NOT ERRORLEVEL 0 GOTO ERROR
GOTO END
:ERROR
echo.
echo There were errors!
echo.
pause
EXIT
:END
pause
You could correct setup teamcity to build using MSBuild using the follow steps:
First you should define the parameter on teamcity that declares the enviroment variables that is seted by rsvars.bat, to do that in your Project access the Parameters and create a new configuration, select the type enviroment variable, set the same names and values from the rsvars.bat file aka: BDS, BDSCOMMONDIR, et all.
After that in you msbuild step edit the target option to "build".
You can see that this information is documented here http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Building_a_Project_Using_an_MSBuild_Command
Here you can see my params configuration
And here is the MSBuild Project configuration
I have windows based Jenkins host and local folder like this:
"c:\Archive\JenkinsBuilds"
When I'm using shell exec to copy build to that folder (all the content of Release folder) I'm getting an error. The issue is because Jenkins adds single quotes automatically and shell exec expectes double quotes only:
I defined env variables:
FINAL_PACKAGE = My-Project\bin\Release
BUILDS_DEST = c:\Archive\JenkinsBuilds\My-Project\$BUILD_NUMBER
and shell exec:
xcopy /i /f /v $FINAL_PACKAGE $BUILDS_DEST
And during execution I see in logs:
xcopy /i /f /v 'My-Project\bin\Release' 'c:\Archive\JenkinsBuilds\My-Project\17'
How to force Jenkins to use double quotes.
If I specify them manually Jenkins adds single quotes in any case what generates the same error:
"Invalid number of parameters"
Thanks to #Cole9350 for advise.
On windows it is better to use windows batch command
And variables usage will be different:
xcopy /i /f /v "%FINAL_PACKAGE%" "%BUILDS_DEST%"
I have a batchfile ( see code below ).
Because the tf command must be executed in the Visual Studio command prompt.
I call the visual studio command.
But then the batch file stops executing.
Somebody have an idea?
REM #echo off
REM ... Change the path below. This is the path where the code will be downloaded!
REM Z:
REM cd Backup_TFS_Preview
call %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86
REM ... Navigate to folder
Z:
cd Backup_TFS_Preview
REM ... Makes folder with date today
mkdir %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%
REM ... Navigate to folder
cd %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%
REM ... Add workspace for the folder with date of today
tf workspace /new %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4% /noprompt
REM ... Get all items from TFS
tf get /recursive /all /noprompt
REM ... Navigate to folder
cd ..
REM ... Zip the folder
C:\TFS_Backup_Scripts\7z.exe a %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%.zip %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%\
REM ... Remove folder
rmdir %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4%\ /s /q
REM ... Delete workspace
tf workspace /delete %Date:~-10,2%-%Date:~-7,2%-%Date:~-4,4% /noprompt
REM ... Navigate to folder
cd ..
cd ..
REM ... Delete zip files that are older then 10 days
forfiles -p "Z:\Backup_TFS_Preview" -s -m *.* -d -10 -c "cmd /c del /q #path"
%comspec% /k runs another command prompt, and then keeps cmd.exe around. Until that cmd.exe returns, your batch file won't continue.
Even if you replace /k with /c (which doesn't keep cmd.exe around), it won't work, because the environment variables from the new command prompt aren't preserved in this one.
You simply need:
call %VS100COMNTOOLS%\vsvars32.bat
Or
call %VS100COMNTOOLS%\..\..\VC\vcvarsall.bat x86
what happens when you execute the call from a cmd prompt?
also note the exit code (0 or 1) for vcvars32.bat (which is called by vcvarsall.bat) so run: Echo %errorlevel%
after you run vcvarsall.bat. if it is zero the command completed successfully.
and you might try and remove the dbl "" like this:
call %comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
that could break the cmd statement up into bad pararameters due to the spaces not being escaped
maybe test for the %errorlevel% right after the call line
last resort, change the /k to /c in the call statement.
post results
I solved it in another way. I used the full path of the tf.exe. And it works in the command prompt.
The call answer doens't worked for me.