I currently use TFS build for my Azure cloud service project.
as a output of that .cspkg and .cscfg file is created after the successful build.
is there any way to add the $(Build.BuildNumber) to my .cspkg file
say for eg: currently my output file looks like
SchoolWebPortalAzure.cspkg
is it possible to rename like SchoolWebPortal_1.0.0.1.cspkg in the tfs build definition.
thanks,
kind regards,
Snegha
You could use the Run Command Line task or do it in a PowerShell script in build.
1). Add the Inline Powershell task from the marketplace before the copy task in build definition.
2).Enter the following Powershell in the text area
Param (
[string]$pathToFileToRename
)
Rename-Item $pathToFileToRename Helloworld_$(Build.BuildNumber).exe
3). Enter any required arguments in the arguments text box (you could
use environment variables) e.g. -pathToFileToRename $(Build.SourcesDirectory)\somepath\CurrentName.exe
Then you will get the renamed file in the drop folder.
Related
I am having hard times attempting to perform the simplest operation: run the custom MSBuild script (placed within dedicated "BuildScripts" folder) from the Lab test running build definition. What it is supposed to do prior to test execution is to trigger the child build, get the built sources and perform the modification of the config file by the means of MSBuild script. And that is what I struggle with. Supposing I have specified the build scripts folder among source settings (mapped to $(SourceDir)) and I use the MSBuild activity for running the script, what do I specify in the path for project file location?
Would appreciate any hints you might share.
Thank you.
If I understand your requirement correctly, you can select the MSBuild script file in Build Process as soon as you have uploaded the file into Version Control.
Clicking the button below:
You will get a dialog to select the solution or project you want to build:
And then click "Add..." button, you will be able to select the file from Version Control.
Never heard the "MSBuild script". If you mean to run powershell script during the build. So where do you want to specify the path for project file ? In the script or the configuration of the build template ? Suggest you to provide a screenshot.
Moreover, you can use "invokeprocess" workflow activity to invoke powershell script during the build.
I have a test project in Jenkins. And each time I build my project it says.
The results file "My File Path" already exists. Please specify a
different results file or verify the existing file is no longer needed
and delete it.
So I've decided to include the build number in the name of my result file.
And I'm using my result file to generate some graphical output also.
How can I include my Build Number in both locations
This is the windows batch command execution
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\mstest.exe"
/testcontainer:"%WORKSPACE%\TestAutomation\bin\debug\TestAutomation.dll"
/resultsfile:"%WORKSPACE%\results.xml"
And I'm using my result file as follows.
How can I change both these locations to add current build number in my result file as followingformat
result_BuildNumber.xml
Try this,
result_%BUILD_NUMBER%.xml - for batch
result_$BUILD_NUMBER.xml - for shell
BUILD_NUMBER is environment variable.
Im trying to setup jenkins in my company and Ive got some problems.
Im using this commands to build the project:
SET MSBuild="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe"
SET BUILDS=C:\Program Files (x86)\Jenkins\jobs\xxx\builds\
SET OUTPUT_PATH="%BUILDS%%BUILD_NUMBER%"
SET RSVARS="C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\rsvars.bat"
CALL %RSVARS%
SET PATH=%PATH%;D:\komponenty\DXE3\ADSI
%MSBuild% xxx.dproj /t:Build /p:Config=Debug;Platform=Win32;DCC_ExeOutput=%OUTPUT_PATH% /maxcpucount:4
It works fine when i type this in cmd but. I gave administrive privileges to jenkins service. When I try to build project with jenkins i receive error like this:
F1026: File not found: 'ADSI.dcu
this is a component for Delphi and i have this component on second partition. Jenkins has access for many components on this partition but not for this one.
The difference between the two will be your current directory.
Jenkins will start you off in a specific working folder for the job (possibly C:\Users\<User-ID>\.jenkins\jobs\<Job-Name>\workspace).
Add the following to your Jenkins commands to see where you're doing the build from:
echo Current Folder: %cd%
A simple "solution" would be to just add a command in Jenkins to change directory to the same folder you're in when you test from the command-line.
However, I suggest you rather do the following:
Ensure Jenkins gets the latest source from your source repository into its working folder. (There are various plugins depending on what particular tool you use.)
Ensure you cd (change directory) to the correct folder within the workspace folder.
I would like to create a TFS 2013 build definition, which builds a SQL project and outputs the complete CREATE DATABASE script to the bin folder.
When I compile my project on the local machine, the SQL script is output to the bin[configuration] folder correctly as per the database project settings.
However when I build the same project using TFS build automation, the build succeeds but no bin folder is created and no sql script is output.
Any ideas what I'm doing wrong?
Additionally, when the script is output locally, the paths are blank:
:setvar DefaultDataPath ""
:setvar DefaultLogPath ""
Any idea how I can populate these for SQL Server 2008 r2 defaults?
Edit:
Actually, if I set the build to target only the .sqlproj file, then the bin is output correctly. The problem comes when the sqlproj is built as part of a solution with other projects.
The build agent does not create individual bin folders in the src working directory; only the start-up project's output is produced and copied to the final bin folder.
I would like the build to generate the sql script and copy it to the output folder along with the other project outputs.
Is this possible?
I ended up going with a workaround based upon This Answer.
If I build the database project as part of the solution, the script does end up in the drop folder, just not the build agent's working folder.
Using:
<CommentOutSetVarDeclarations>True</CommentOutSetVarDeclarations>
in the publish profile allows me to set the default path etc. from the command prompt which was an acceptable alternative in my case.
As part of my TFS 2010 team build, I'm trying to copy a configuration file from a network location to the output folder where the build goes to.
Using xcopy as an invoke process task, I've successfully gotten it all working EXCEPT that I want to rename the file as part of the copy. The problem is that if you supply a different destination filename, XCOPY asks if the destination is a file or a directory e.g.
XCOPY \\networkshare\configs\live.config \\networkshare\release\server.exe.config /R /Y
results in XCOPY asking me to press F if server.exe.config is a file or D if it's a directory. XCOPY doesn't seem to have any way to suppress this behaviour. I've tried using the basic COPY commmand but Team Build just says that it doesn't recognise the COPY command.
Is there any way to easily rename a file as part of Team Build or use another command line tool to achieve this?
Cheers
Just to confirm - setting the process as CMD.EXE and starting the arguments as "/c copy" does the trick.