Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty build artifacts in Visual Studio Team Services

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.

like image 696
Bas Avatar asked Apr 28 '16 07:04

Bas


People also ask

Where are build artifacts stored?

Build artifacts are stored on a Windows filesystem, which causes all UNIX permissions to be lost, including the execution bit.

Which of these is an example of a build artifact?

Build artifacts are files produced by a build. Typically, these include distribution packages, WAR files, reports, log files, and so on.

What are TFS artifacts?

Artifact sources - TFS serverBuilds from an on-premises TFS server are downloaded directly into the on-premises agent, and then deployed to the specified target servers. They will not leave your enterprise network.

What is artifacts in Visual Studio?

Artifacts are the files you choose to 'keep' after compiling your Visual Studio sln file. For example: This assumes you have a sln that compiles 2 projects, ConsoleApplication and WebApi - this example says keep all the output of ConsoleApplication and all the dll's of WebApi.


1 Answers

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

like image 126
Eddie Chen - MSFT Avatar answered Sep 24 '22 03:09

Eddie Chen - MSFT