Stefan Wilms
Stefan Wilms

Reputation: 83

How to publish a asp.net project to filesystem in VSTS Build

I have a aps.net 3.5 solution stored in TFS. Usally I choose "publish" in VS2015 to get only the needed files into a target directory. That I use to create a package for deployment to a webserver. Now I want to use the buildserver to create that package. My problem is, I can build the solution with a "Visual Studio Build"-Step, but I can't tell which files to copy by a "Copy Files"-Step.

I thought to call msbuild.exe using powershell but had no success setting a target directory for an existing profile. With /p:OutDir it copied the wrong files. A "IIS Deployment"-Step does no simple filesystem copies, as far as I can see.

So how can I do what VS2015 does by "publish" with target filesystem on the Build-Server using dynamic output directories.

Upvotes: 1

Views: 892

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33708

Refer to these steps:

  1. Click new to create a new build definition
  2. Select ASP.NET build template
  3. Select Visual Studio Build task and choose corresponding version of VS in Visual Studio Version input box

  4. (optional) Remove Visual Studio Test and Publish symbols path tasks.

With ASP.NET build template, you can find that, there is the MSBuild Arguments like this, which is used to create web deployment package and put it to artifact directory:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"

Upvotes: 1

Related Questions