TFS 2015 - Build solution, package project. Also b

2019-08-18 06:38发布

问题:

I have a solution with 8 projects in it and only 1 of them is a web site/app. The rest all create assemblies that are referenced in the web app.

I want to build the solution and then package the web site project into a web deploy package.

So in TFS, I've added the Visual Studio Build step (no other steps in the definition after this), pointed it to the solution and added the following MSBuild arguments:

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

Note that in TFS source control, there are 2 solution folders. For this build, I just want to build one of the solutions. So I've given it the full path to the solution I want (without any wildcards).

The build succeeds and when I look in that directory (\TfsData\Build_work\1), it has created 4 folders in there: 'a', 'b', 's' & 'TestResults'.

Folders 'a', 'b' & 'TestResults' are empty.

The 's' folder has a '$tf' folder with a bunch of stuff in there that I don't know what it's for.

The 's' folder also has BOTH solutions in there. I don't want the second solution build/placed there. Just the first one.

And I can't find any web deploy (zip) packages for the web app in the first solution. It's just the built folders.

回答1:

  • S stands for Build.SourcesDirectory

    The local path on the agent where your source code files are downloaded. For example: c:\agent\_work\1\s

  • A stands for Build.ArtifactStagingDirectory

    The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent\_work\1\a

  • B stands for Build.BinariesDirectory

    The local path on the agent you can use as an output folder for compiled binaries. For example: c:\agent\_work\1\b.

According to your description, you need to cloak folders you don't need in source mappings under Repository of your build definition.

Besides, you have to use Copy and Publish Build Artifacts to publish your build artifacts to drop folder(sever path) or a shared path.