0
votes

enter image description hereI want build and release one dot net app from VSTS to Azure web app . For this I have added some steps as shown in snap enter image description here

apart from this whenever i do build solution, it fails or succeed but artifact is empty (sometimes). Also logs shows error

D:\a\1\s is empty. No artifacts Build is failed everytime with following two errors. Shall I reinstall Nuget packages? What is value for $(build.artifactstagingdirectory) enter image description here Also please let me know what process should I follow.

Note: Azure app ( free tier plan ). App is developed in VS 2015. Kindly let me know if any information required.

1
right click on the project node in the solution explorer pane, and choose 'Publish...'Joseph Wu
What's the app type? Asp.Net or Asp.Net Core?Eddie Chen - MSFT
Do you solve this issue with my solution?starian chen-MSFT
No not yet. My objective is to build with VSTS with hosted agent. But no luck. I tried setting by you but it gives error 1) D:\a\1\s\project_name.sln.metaproj:D:\a\1\s\project_name.sln.metaproj(0,0): Error MSB4057: The target "FileSystemPublish" does not exist in the project. Process 'msbuild.exe' exited with code '1'.> 2) Error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.Kunal
Can you share the detail build log here?starian chen-MSFT

1 Answers

1
votes

You can call dotnet publish command through .Net Core (Command: publish, Arguments: -c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory), Check Zip Published Projects) or Command Line step/task to publish your web to artifact directory, then archive the output into a Web Deploy package if you are using Command Line step/task.

More information, you can refer to this article: Build and deploy your ASP.NET Core app to Azure

Update:

You are using Asp.Net app, refer to these steps to create a new build definition:

  1. Click New button to create build definition
  2. Select Asp.Net (Preview) template
  3. Configure repository

With this template, you can find that there is MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\" for Visual Studio Build step/task, which is used to publish web app to web deployment package (zip).

Note: if there is error during the build, the web deployment package won’t be generated, so it can’t find the file to publish for Publish Build Artifacts step/task. You can uncheck the option of Always run.