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"
Related
I have a requirement to run webtests which are located in a particular folder through a build. Currently the tests are run from Visual Studio 2015.
Got to know to execute/use the below powershell script as a task. But clueless how to implement it. Is this powershell script enough?.
param
(
$tool = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe",
$path ,
$include = "*.webtest"
)
$web_tests = get-ChildItem -Path $paths -Recurse -Include $include
foreach ($item in $web_tests) {
$args += "/TestContainer:$item"
}
In this, how to pass in the $path value? Do I need to give the path of the directory which has all these 5 webtests?
Do I need a testsettings file to carry out this execution.
If I need a test settings file, do I need to copy all the webtests file to output directory?
All I get with this powershell is the below message
No test runs are available for this build. Enable automated tests in
your build definition by adding a task that runs tests for your test
framework of choice, such as the Visual Studio Test task. If you choose
to run tests using a custom task or runner, you can publish results
using the Publish Test Results task
Could any one please help me as in what I am missing here? Thanks for your time and help on this.
how to pass in the $path value?
When you use the powershell task to execute your powershell scripts, there is a option Arguments, which you could pass the value of $path:
Do I need to give the path of the directory which has all these 5
webtests?
Yes. In general, the .webtests file are all copied to the drops location, so the path always point to the drops location.
Do I need a testsettings file to carry out this execution.
The short answer is yes.
There is a great blog about how to Running WebTests as part of a VSTS VNext Release pipeline, you can check if it helps.
Hope this helps.
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}
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.
I have inherited some InstallShield InstallScript projects.
I am currently using InstallShield 2009.
I cannot seem to create a log file when I run the setup.exe.
What command line options do I need to specify?
InstallShield has a method for creating a log file for the Setup.exe and Update.exe bootstrappers. You can simply use the /debuglog parameter from the command line when you run Setup.exe. This command line parameter can be used with the Setup launcher for Basic MSI, InstallScript MSI, and Web projects.
Here it is:
Setup.exe /debuglog
You will notice that a file called InstallShield.log has been created in the same folder as Setup.exe.
For more read >> http://www.installationdeveloper.com/686/using-log-files-in-installshield/
There is no such feature in InstallScript project types. The really good logging is in MSI project types. InstallScript really only has the ability to record a response file and generate a very terse logfile as part of a silent install. (/s /f1 /f2 arguments)
Setup.exe Command-Line Parameters
You can add registry settings which will tell Windows Installer to log your installation.
The registry settings you'll need are:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
"Logging"="voicewarmup"
"Debug"=dword:00000007
Once you run the installation, navigate to %temp% inside windows explorer and there will be .LOG files with a naming scheme of MSI#####.LOG.
NOTE: This should log all installations on your machine, so you may want to delete these registry settings when you're done.
I'm trying to show the results of visual studio unit tests within CruiseControl. Here is the relevant part of my config:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\mstest.exe
C:\Build\Test\TestCases\
/testcontainer:H4Test\bin\debug\H4Test.dll /runconfig:localtestrun.Testrunconfig /resultsfile:H4Test\H4Results.trx
900
C:\Build\Test\TestCases\H4Test\H4Results.trx
The issue is that the H4Results.trx can only be created once, so every subsequent run just shows the results of the first run of the test cases. I need to specify the name so that I can do the merge command. How do I get this working?
Thanks,
Justin
Here's the answer, creating a bat file to delete the .trx each run:
http://blogs.blackmarble.co.uk/blogs/bm-bloggers/archive/2006/06/14/5255.aspx