VSTS build ended with empty build artifacts

asp.netazure-devopsazure-pipelinesmsbuild

We are using VSTS build using ASP.Net template. We are passing MSBuild Arguments as below-

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

We see no build error. From the log we observe a line –

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /LRM -p ..\LRM\ -u -f -d PrecompiledWeb\LRM\

where LRM is the .NET sln name which we are building. This sln contains multiple projects along with the LRM website.

At the end of the build pipeline we see no artifact generated. We see a warning at the "Publish Build Artifacts" saying –

2018-01-03T06:07:47.9208838Z ##[warning]Directory 'D:\VSTS Agents\DEV-QAS\A1\66\a' is empty. Nothing will be added to build artifact 'drop'.

Best Answer

Use below as msbuild arguments (/p:OutDir="$(build.stagingDirectory)" is the diffrence)

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

Use Publish task Path to publish as "$(build.stagingDirectory)\_PublishedWebsites" if you only want the website output. If all the files in staging directory required use "$(build.stagingDirectory)" as path to publish

enter image description here

Related Topic