2

My problem is similar to this

Build and Deploy a Web Application with TFS 2015 Build

But, the solution is not working for me. I am working on Continuous Integration, and I have to Deploy a Web Application, and others Website, with the website I don't have problems creating the .zip Package for the deploy. I am using /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.StagingDirectory)\\"

Then I am using Deploy IIS App for extract the .zip Package in the virtual directory for the website.

enter image description here

But with the Web Application no matter what Arguments I use in the MSBuild Arguments nothing works, and I don't want copy all the file from the project to the server, and I would like an option different from remove the .sln and other file after the release from the server.

I tried /p:DeployOnBuild=True /p:PublishProfile=$(DeploymentConfiguration) and I used a publish profile created as Web Deploy Package but after the build in the artifacts I get the same files, I mean all the projects files including .sln.

I am not sure what should I expect in the artifact when I use /p:DeployOnBuild=True /p:PublishProfile=$(DeploymentConfiguration), but I am not seeing changes.

Can someone explain me what should I wait in this case?? and How to deploy correctly the Web Application Project using the TFS (because when I publish from the Visual Studio using the .pubxml works fine, in the server just the rights file are being copied) and the idea is make the Build and Release in the TFS no using nothing manual from Visal Studio.

Any idea and explanation is going to be welcome, Thanks.

Community
  • 1
  • 1
Yanet Francisco
  • 147
  • 4
  • 19

2 Answers2

2

Nothing was working until I was looking into the TFS options for Build Definitions and when you have to select a template for the definition, you can see two options Build and Deployment, I was selecting Build's template but I tried with a Deployment option : enter image description here

and by default in the MSBuild Arguments the parameter is :/p:OutDir="$(build.binariesdirectory)\\" enter image description here

In that folder we have everything we need for the deployment.

Yanet Francisco
  • 147
  • 4
  • 19
1

To pass parameters into MSBuild you need a .pubxml file (called the publishing profile) within the PublishProfiles folder under your project properties folder. This is why using /p:DeployOnBuild=true;PublishProfile=MyProfile as the msbuild arguments. More details please refer Sayed Ibrahim Hashimi in this question: How do I configure MSBuild to use a saved publishProfile for WebDeploy?

If you want to generate Artifacts please make sure you also use the Publish Build Artifacts build step. Copy the Artifacts of the Build and Publish the Artifacts to Drop Location on the Server. This will be the location to later on pick the build artifacts for the Release. The files will locate at the staging folder-- Build.StagingDirectory something like agent/_work/2/a

enter image description here

For more details take a look at this topic Visual Studio Team Services Release Management IIS Web Deployment vnext

Bernard Vander Beken
  • 4,848
  • 5
  • 54
  • 76
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62