6
votes

I have a build definition in Visual Studio Team Services with the following steps:

  • PowerShell (prebuild.ps1 powershell script that sets up DNX
  • NuGet Installer
  • Visual Studio Build
  • Copy and Publish Build Artifacts

The MSBuild arguments in the Visual Studio Build step are as follows:

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

And the Copy Root in Copy and Publish Build Artifacts is set to $(build.stagingDirectory) with Contents set to ***.* and Artifact name set to drop.

The build succeeds, but when I look in the Artifacts, it's just an empty drop.zip.

Looking at the logs for the Publish Artifacts step, it says

2016-04-28T07:37:41.7047278Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.98.1\tasks\CopyPublishBuildArtifacts\1.0.22\CopyPublishBuildArtifacts.ps1
2016-04-28T07:37:41.8467280Z Preparing artifact content in staging folder C:\a\1\a...
2016-04-28T07:37:41.9187272Z Total files copied: 0.
2016-04-28T07:37:42.3778918Z Max Concurrent Uploads 2, Max Creators 1
2016-04-28T07:37:42.4218914Z Found 0 files to upload.
2016-04-28T07:37:42.4268927Z Created 0 files without uploading content. Total files processed 0
2016-04-28T07:37:42.4288961Z Uploaded artifact 'C:\a\1\a\drop' to container folder 'drop' of build 38.
2016-04-28T07:37:42.6274164Z Associated artifact 31 with build 38

Why are there no files to upload? I'm looking to eventually create a web deploy package that I can then deploy as an azure web app, but getting the package in the first place doesn't appear to work.

Edit: when I run msbuild locally with the same parameters, I get an artifacts directory with bin and obj subdirectories containing a bunch of .nupkg files, some dlls and some other assorted things, not a .zip file. It seems like I'm missing something, but all the tutorials I can find tell me to use these msbuild parameters.

1

1 Answers

5
votes

According to your description, you are build an Asp.Net Core project. Then the issue may caused by the arguments you use. There is no file generated in "$(build.stagingDirectory)" folder with this arguments. Try to set the arguments to

"/t:Build,FileSystemPublish
/p:PublishConfiguration=$(BuildConfiguration)
/p:PublishOutputPathNoTrailingSlash=$(Build.SourcesDirectory)\{yourProjectName}\artifacts\bin\$(BuildConfiguration)\Publish"

and then copy files from

"$(Build.SourcesDirectory)\{yourProjectName}\artifacts\bin\$(BuildConfiguration)\Publish".

Refer to this link for details: Build and Deploy your ASP.NET 5 Application