Package multiple publish profiles .pubxml after a successful build in Jenkins CI - asp.net-mvc

I'm using Jenkins for Continuous Integration.
Right now I have a job with this command in Jenkins in the command line arguments for a build step:
This is the command:
"%WORKSPACE%\OEVizion\ITVizion.OEVizion.Web\ITVizion.OEVizion.Web.csproj" /p:DeployOnBuild=true /p:PublishProfile="IT Vizion - Web Deploy Package for a given domain.pubxml"
It works just fine, that is, the web deploy package (.zip) is created in the specified folder defined in the .pubxml file.
However what I'd like to do is to generate a .zip web deploy package for each of the .pubxml files that I have (right now 3) for this specific ITVizion.OEVizion.Web.csproj in a single shot\command.
With this I'd have multiple .zip packages with different settings ready to be deployed to different servers every time a commit is pushed to the repository and the project builds successfully.
Is this possible? How should I approach this?

The best practice is to build only once and then publish multiples times from the same build. Here is a screenshot of how to set that up:

After posting the question I saw the way to go about this: Add multiple build steps. One for each .pubxml file. That way the build process will run 3 times for the 3 publish profiles and you'll end up with 3 web deploy .zip packages at the end of the Job execution in Jenkins. Nice.

Related

where to get build file to deploy to server

I've set up config to tell circle ci what to build and how to build.
After the the build I want to send all the built files to my ftp server, which is a share host (host-gator)
Can I instruct circleCI to do so?
There's two separate things here. If the build files that you want to upload are your application itself, then this is considered a deploy. You can do this in the deployment phase in circle.yml. More info can be found here: https://circleci.com/docs/configuration/#deployment
If the build is "other" files that you want to upload for record keeping, debugging, or basically a deployment for someday in the future, you can utilize what are called build artifacts: https://circleci.com/docs/build-artifacts/

VSTS Build Not Dropping All Files for Web Application

When I started writing this question, my problem was that after a successful VSTS Build, I wasn't able to see the files relating to my web application project for release. Only the files from certain other projects in the solution were present. However, I just came across this question, which has helped.
I can now see the compiled .dll files for my web application project, after altering the configuration of the Content setting in the Build - that is, the contents of the Bin folder under that project. But I can't see anywhere the other files I need to copy the built web application to my server - the views, the scripts, the css, etc.
I'm finding the power and flexibility of VSTS's Build and Release functionality very confusing as it's complete overkill for our requirements. Up until now, I've just right-clicked on the web app project in Visual Studio selected Publish and used the File System publish method. Easy. Now that I want to automate the building and deploying of the application, it's many times more complicated!
So, can anybody tell me how I can get the solution to build in VSTS in such a way that I can then use a Copy Files task in the Release Definition to copy the files to our web server (the server isn't visible to the Internet so I'm using a locally-hosted Agent)?
In vNext build, to publish your build artifacts with the Copy files or Publish build artifacts steps. Try to use the local path on the agent where any artifacts are copied to before being pushed to their destination. For example:
Add /p:DeployOnBuild=true
/p:OutDir="$(build.artifactstagingdirectory)\" arguments in Visual
Studio Build step;
Change "Path to Publish" of Publish Build Artifacts task to
$(build.artifactstagingdirectory)\_PublishedWebsites\ProjectName:
Details please check the screenshot of build step with this question: How do I get the the expected output from a TFS 2015 build (to match my XAML build)?
Base on your comments, you have published the web app from Visual Studio. Usually, this action will generate a publish profile under Project/Properties/PublishProfiles folder. The settings you used to publish the web app is stored in the profile. So you just need to make sure this publish profile is checked into source control. And then in the TFS build, add following MSBuild arguments:
/p:DeployOnBuild=true /p:PublishProfile="publishprofile.pubxml"

Build and Deploy a Web Application with TFS 2015 Build

We have just installed TFS 2015 (Update 1) on-premise and are trying to create a Continuous Integration/Build system using the new TFS Build system. The build works fine, and gives me a green light, but when I look at the default build it has only built the binaries from the bin directory, and there seems to be no easy way to deploy the app on-premise to a local server.
There are two deploy options for a filesystem copy, and a powershell script, and it would certainly be easy enough to use them to copy files to a new server, but since the build only built the binaries, I don't see a tool to gather up the Web artifacts (cshtml, images, scripts, css, etc..) for this.
After an exhaustive google search, I've only found one article which talks about this at:
http://www.deliveron.com/blog/building-websites-team-foundation-build-2015/
However, this uses WebDeploy and creates a rather messy deploy package.
How can I deploy the site (standard MVC web application, in fact my tests are using the default boilerplate site created by the create project wizard) complete with artifacts to a local server in the easiest possible way? I don't want to have to install WebDeploy on the servers, and would rather use PowerShell or something to deploy the final artifacts.
The build is just the standard Visual Studio build template, with 4 steps (Build, Test, Index & Publish, Publish Build Artifacts).
We use "Visual Studio Build" step and as Arguments for MSBuild we use following line:
/p:DeployOnBuild=True /p:PublishProfile=$(DeploymentConfiguration)
On Variables tab page DeploymentConfiguration has to be configured. It must be the Name of the publish Profile (filename of the pubxml file). If the file Name is Build.pubxml the publish profile is Build.
for example:
/p:DeployOnBuild=True /p:PublishProfile=Build
I wanted to add that Ben Day has an excellent write-up that helped us package quickly and then release to multiple environments through Release Manager.
His msbuild arguments look like this:
/p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl=$(build.artifactstagingdirectory)\for-deploy\website
The difference between this and the accepted answer is that this parameter set stages everything in an artifacts folder, and then saves it as part of the build. We can then deploy exactly the same code repeatedly.
We capture the web.env.config files alongside the for-deploy folder and then use xdt transforms in the release process to ensure everything gets updated for whichever environment we're deploying to. It works well for all our web projects.
We use WebDeploy/MSDeploy for 40+ applications and love it. We do install WebDeploy on all our servers so we can deploy more easily but you could also use the Web Deploy On Demand feature which doesn't require WebDeploy be pre-installed.

Running one build per artifact of another job

I have a jenkins job to create multiple debian packages. Each created package file is archived as artifact of the build. This works well so far.
Currently I am trying to to trigger multiple builds of another job, one for each created package file. This job should install each package in an isolated vagrant box and do some tests on it.
The question is how to trigger the builds. As it would be nice to parallelize the builds it is not easy as doing one build for all packages. The number of packages is not always the same, so it is very uncomfortable to duplicate the job for each package.
Thanks,
krissi
To act on every build of a project, you probably want "Promotions". Read about it here:
How to promote a specific build number from another job in Jenkins?

Jenkins: Testing on every commit AND releasing on click with the same project

1) I want to run my testsuite on every commit, so Jenkins should poll SVN, make an update and run the tests. That's possible without problems, BUT...
2) I also want to be able to create builds, which additionally covers creating zip archives and transferring them via scp to a remote server.
How is this possible within the same project?
Have you checked Jenkins SCP Plugin? You can add an aditional build step in the existing project itself which creates your builds, generates zip archives etc. And at last as a post build action publish the artifacts to a SCP repository. Will that help?

Resources