0

I am using Visual Studio Team Services. I created a Simple ASP.NET website and created my Build definition which contains default settings.

enter image description here

After committing changes, the build is triggered using CI. The "Build Solution" Step works fine, however no files are found in the Copy Files Step:

enter image description here

I have created the same build definition for a simple console app, and the build and release are working.

When Creating a release from this build, it fails to deploy (i guess because no files are found in (Build process)) and gives the following error:

enter image description here

Hussein Salman
  • 7,806
  • 15
  • 60
  • 98

1 Answers1

2

When you build Asp.Net project with a default VSBuild definition, the folder bin\$(BuildConfiguration)\ does not exist. So "Copy Files" task cannot find any files with the default settings. A simple way to fix your issue is add /p:outdir=$(build.artifactstagingdirectory) in "MSBuild Arguments" for VSBuild task as following:

Add custom arguments to MsBuild

And you can also remove "Copy Files" task since "Publish Build Artifacts" task publishes the files in $(build.artifactstagingdirectory) folder by default and you have set the build output to that folder with the argument added in VSBuild task.

Update: You can add a "Copy Files" task with the following settings to copy "roslyn" folder to "bin" folder: enter image description here

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • Regarding further simplifications, is NuGet Installer actually required? I don't use it and package restore just happens. – Graham Smith Apr 22 '16 at 08:08
  • 1
    @GrahamSmith This depends on your project. If you have nuget package reference in your project, then you cannot remove it. Generally, if you are creating the Asp.Net project with VS Template, then it is needed since the template use a lot nuget package reference. If the nuget packages are not restored before build, the build will fail. – Eddie Chen - MSFT Apr 22 '16 at 08:13
  • To take this a stage further, you can use **$(build.stagingDirectory)\_PublishedWebsites** for the **Copy Root** property of the **Copy and Publish Build Artifacts** task to you get your web files neatly packaged in to an artifact. – Graham Smith Apr 22 '16 at 08:26
  • Thanks @Eddie for you answer. After, configuring it as you proposed in the image. It created the following under the _drop_ folder: 1- **roslyn** folder which contains some dlls and exe, 2- **_PublishedWebistes** (which contains my websites and bin inside it), 3- and the **dll** files. However, the **rosyln** folder is missing in the bin of the project under "_PublishedWebsites" which causes an error when running the site under IIS – Hussein Salman Apr 22 '16 at 15:21
  • You can add one more "Copy Files" task to copy the "rosyln" folder to "bin" folder. See the screenshot I added in answer for details. You can also update your project file to add a MSBuild task to do this. Refer to this question for details: http://stackoverflow.com/questions/32780315/could-not-find-a-part-of-the-path-bin-roslyn-csc-exe – Eddie Chen - MSFT Apr 25 '16 at 02:55