Jenkins build Visual Studio Solution with Different Configuration - visual-studio-2012

Hi I have a visual studio solution which has been configured in Jenkins. And it's building successfully in debug configuration. How ever I need to change the build configuration to Release or another different one.
So How can I configure Jenkins to select the configuration to build?

If you are using the MSBuild plugin, try adding the configuration flag on the "Command Line Arguments" section:
/p:Configuration=Release
If you are simply building from command line script (batch, powershell, etc), add the above flag there..
What I do, is create a generic job for build process which receives a parameter called "BUILD_CONFIGURATION" from the parent job which triggers it.
And I then reference it in the flag as a variable:
/p:Configuration=${BUILD_CONFIGURATION}

Related

Automate build SQL database projects through VS-CMD, other options?

I'm trying to automate build process for SSDT SQL Database Project.
I have a build script that i can run on VS command prompt to get dacpac file however my window agent doesn't have VS command prompt so i'm looking for other options here.
Please help.
use "Visual studio build" task which will automatically generate dacpac file for you for your database project.
If you pass the solution path to VS build task, it will take all the deployable project inside the solution and creates the necessary artifacts in a separate zip for each deployable project in a solution.
Reference: https://www.gatevnotes.com/continuous-integration-continuous-deployment-of-ssdt-projects-creating-azure-devops-pipelines/
You could use Command Line task to run a program from the command prompt. Azure Pipelines puts your inline script contents into a temporary batch file (.cmd) in order to run it. When you want to run a batch file from another batch file in Windows CMD, you must use the call command:
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=azure-devops&tabs=classic#running-batch-and-cmd-files
For example :
echo call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Tools\VsDevCmd.bat"

Jenkins tfs plug-in and checkout source on remote node

First, I'm a Jenkins neophyte. I have made a free-style software project in Jenkins to perform my Linux build. The Jenkins server is running on Windows so there are slave nodes configured for doing this Linux build. The sources are kept in a TFS server.
I updated our TFS plugin to the latest of 4.0.0. This plugin says that it is no longer necessary for slave nodes to have the Team Explorer Everywhere package installed as it uses the Java API. However, when I kick off my build, I get this:
Started by user Andy Falanga (afalanga)
[EnvInject] - Loading node environment variables.
Building remotely on dmdevlnx64-01 (PY27-64 CENTOS6-64 LOG4CPLUS PY26-64) in workspace /home/builder/jenkins/workspace/Linux Autotools Build
Deleting project workspace... done
Querying for remote changeset at '$/Sources/Branches/Andy/AutotoolsMigration' as of 'D2015-10-05T18:26:27Z'...
Query result is: Changeset #4872 by 'WINNTDOM\afalanga' on '2015-09-25T23:36:24Z'.
Listing workspaces from http://ets-tfs:8080/tfs/SoftwareCollection...
... Long list of workspaces
Workspace Created by Team Build
Getting version 'C4872' to '/home/builder/jenkins/workspace/Linux Autotools Build'...
Finished getting version 'C4872'.
[Linux Autotools Build] $ /bin/bash /tmp/hudson7081873611439714406.sh
Bootstrapping autotools
/tmp/hudson7081873611439714406.sh: line 4: ./bootstrap: No such file or directory
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
I log into that system and look in the directory /home/builder/jenkins/workspace/Linux Autotools Build and sure enough, there's nothing there. My configuration is pretty simple.
I have discard old builds checked and a simple rotation (this is just me learning how to use it).
I have it set to "Restrict where the build is done" and a label which associates to the 3 slave nodes for doing this build.
All TFS credentials are input and correct.
No build triggers
A simple shell script for Build->Execute Shell which bootstraps the autotools and calls configure and then make.
What am I doing incorrectly?
I found the answer and am posting it here in case someone runs into this. This seems better than simply deleting the question. The TFS plugin doesn't seem to like spaces in the project name. The name before Linux Autotools Build which didn't work and the name now, LinuxAutotoolsBuild which does.
The errors provided by the Jenkins system didn't provide enough information for this to be apparent. After trying a few other things the thought occurred, "Perhaps the spaces are causing grief."
Hope this helps someone.

Run PreSync/PostSync commands via WPP deploy.cmd

I'm trying to figure out how to run a pre/post command using the deploy.cmd generated by VS/MSBuild. I understand there are pre/postsync commands which can be set on the command line with msbuild but this is fixed within the web deploy package inside of the x.deploy.cmd.
How do I go about customizing the output of this file so that I can run the deploy command with specific parameters?
The intention is a non-developer will pick up the package zip file and import the application into IIS. We use IIS to host some windows services and so to be able to deploy we need to stop and uninstall the service before deployment and then install restart in the post deploy stage.
For certain servers we allow auto deployments from TFS and hook this pre/post command using the .targets file of the msbuild WPP pipeline. However, we want to this to be available to the manual deploy command files.
PreSync/PostSync are features of the msdeploy command line and are not supported by the package/manifest providers, or even the API. They are equivalent to running msdeploy a second time, so there's no way you'll be able to include their functionality while directly importing the package into IIS.
I'd recommend having a batch/powershell file on the server that the user runs after copying the package into the same directory.
The .cmd file that MSBuild generates is boilerplate script that you can simply change to call your pre/post powershell scripts. Just overwrite the one generated by the build with your custom one.

How can I get Unit Tests to run against the appropriate DLL when the DLL cannot be referenced in the project?

I've got the following "Pre Build Event" working for my powershell builds (including our Continuous Integration). It simply moves a DLL into the output directory based on the Processor Architecture.
if '$(PROCESSOR_ARCHITECTURE)'=='AMD64' (copy /y "$(ProjectDir)x64\sqlite3.dll" "$(OutDir)")
if '$(PROCESSOR_ARCHITECTURE)'=='x86' (copy /y "$(ProjectDir)x86\sqlite3.dll" "$(OutDir)")
if '$(PROCESSOR_ARCHITEW6432)'=='AMD64' (copy /y "$(ProjectDir)x64\sqlite3.dll" "$(OutDir)")
The problem I'm running into is when I run the Resharper Unit Tests within the IDE. When I do this, the Pre Build event doesn't run, and therefore all of the tests that depend on the sqlite3.dll fail.
What I need to do is either be able to move the appropriate file into the output directory before the Test Runner runs, OR make sure the Test Runner runs against ONLY the x86 Architecture, whereby I can just drop the appropriate file in the bin\debug folder and be done with it.
Things I've tried:
I've tried setting the "Build Settings" to "Always Build" but this has no affect on the outcome. It appears as though the build in the IDE doesn't run the Pre Build Event
I've also tried to set the default platform architecture in [Resharper -> Options -> Tools -> Unit Testing] - as per the docs, but unfortunately my version of R# doesn't have that option (7.1.3)
You can force the C# project to be 32 bit only, and the ReSharper runner will only run it as 32 bit. That way, you can drop the x86 dll in the bin\debug folder and it should all just work.

Cruisecontrol.net nant results different from non-cc.net

I've a nant script that builds a VS2008 solution. When I run it myself by typing 'nant' in the command line all the correct DLLs are copied to the respective bin directories. But when Cruisecontrol performs the CI build no DLLs are copied to the bin directories.
Any ideas what's causing this?
Your problem, dear Mr. Flibble, is that you have specified "test" as the target in the cc.net config which is overrigind the default target (build) that gets executed when executing nant from the commandline.
Very probably there is something in your environment not in the Cruise Control environment. Add something in the CruiseControl build (like setting verbose on nant) and confirm you have the same paths set up.

Resources