Deploying WebSite builds to Azure from VSTS Release Management
Asked Answered
I

2

28

I'm kicking the tires on the preview for the Visual Studio Team Services new Release Management system. My scenario is a classic website (ASP.NET 4.5) with a Git repo hosted in VSTS. The build definition is successful as seen here:

enter image description here

It is set up to publish as an artifact that can be picked up by Release Manager as shown here:

enter image description here

On the Release Manager side I have that artifact linked properly as shown here:

enter image description here

And here you can see my environments as well as the associated tasks (all 3 are clones)

enter image description here

When I run the release the build publishes fine, it connects to my subscription but when it attempts to find the package file it has the following error on line 101 of the output log:

"No files were found to deploy with the search pattern 'C:\a\4fe43dd1a***.zip'"

Here is the full output:

enter image description here

This is where I am stuck as I assumed my artifact link via VSTS should resolve this path for me. Obviously I am missing an important piece of the puzzle somewhere, but I've followed the available documentation as best as I can.

If anyone has a solution or can point me in the right direction it would be much appreciated!

--- EDIT ---

I used the file picker to select a web deploy package (see below). I tried using the root website as well as the bin folder. Both attempts results in an error stating: "No files were found to deploy with search pattern 'C:\a\4fe43dd1a\Classic Website Definition\drop\ClassicWebsite\bin'"

enter image description here

--- EDIT 2 ---

I added an MSBuild task to my BUILD process with the following MSBuildArguments

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

and in my Copy/Publish Artifacts task I limited my output to only copy .zip files. Now in my RELEASE process when I navigate to find a "Web Deploy Package" the "drop" folder is empty. Here is a screenshot:

enter image description here

I think I'm on the right path, I just need help figuring out to tune my BUILD tasks to generate the right artifacts for my RELEASE process to use. Any help would be appreciated.

Ines answered 3/12, 2015 at 0:38 Comment(0)
H
23

The deploy package isn't copied to artifacts folder. That's why the release management cannot find the package. Setting "Copy and Publish Build Artifacts" to the following should fix your problem: VSTS Copy and Publish Artifacts drop build step

Hescock answered 3/12, 2015 at 8:38 Comment(10)
I believe that the issue with the Publish Build Artifacts task has been resolved as of 1/5/16.Kareykari
@JoshuaDrake thanks!, is there a link/article about their fix?Braille
@Braille No, I simply noticed changes in the task's layout during a related change. Specifically it no longer retained some of the options from the deprecated task.Kareykari
I'm having this same issue and the publish build artifacts is set as above other than there is no contents pane now. It still doesn't work on release with the error.Athena
@JamesHancock "Contents" pane is not available for "Publish Build Artifacts" task. You need to add a "Copy and Publish Build Artifacts" step.Hescock
So I removed the copy and the publish build separate steps that were there from the default created and did the copy and publish Build artifacts using $(build.stagingDirectory) as the copy root and ***.zip but it didn't generate any artifcates. And without this and just the standard it doesn't appear to be building the web api project, although the test project that includes it does get built as do everything else. What am I missing? Thanks for the help!Athena
@JamesHancock I just tried with "Publish Build Artifacts" task, the package can be published to artifacts successfully even without "***.zip" specified. Can you open a new question and add the screenshot for the settings in your build definition?Hescock
Sure. I think the issue is that the project isn't building: #35561855Athena
These options no longer seem relevant to the current setups available in Azure and VSTS. And the obstacle is largely the same for me and so far insurmountable.Seitz
@MichaelO'Neill The option is deprecated. You must now use the "Copy File" and "Publish Artifact" tasks in conjunction.Transpire
H
5

Change $(System.DefaultWorkingDirectory) to $(Agent.ReleaseDirectory). The artifacts will be put in that folder. I don't know exactly what $(System.DefaultWorkingDirectory) maps to, but my impression is that it's something outside of the folder used by the agent for your release.

Also make sure that the published artifacts contains the expected zip file -- if the deployment package isn't getting created, or if you're not publishing the output folder that contains the package, obviously you won't be able to release it later.

When you build your web application, make sure it's packaging for deployment by using MSBuild arguments that package it up. Something like this should work:

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

Hobbyhorse answered 3/12, 2015 at 1:53 Comment(10)
Thanks Daniel. I made that change & in both cases the path resolved to: "C:\a\4fe43dd1a\" - I then used the file picker next to that text box & was able to navigate my project within the "drop" folder that is created by my build process. I guess I just need to point the right path, but I'm not sure which. I tried pointing it to "$(System.DefaultWorkingDirectory)\Classic Website Definition\drop\ClassicWebsite" as well as "$(System.DefaultWorkingDirectory)\Classic Website Definition\drop\ClassicWebsite\bin" but in both cases I get "No files found to deploy" but the project files are there...Ines
Does the bin folder actually contain the zip file you're trying to deploy?Hobbyhorse
No, but if you look at my updated screenshot the release is no longer looking for a zip. Is a zip the required format? If so How do I make this part of my build/artifact? If a zip is not a required format what are my options to product a proper artifact for RM to use?Ines
I tried adding a web deploy task to my build, but it wants me to add my azure subscription info for the deployment to publish to. This doesn't seem right as it would deploy a single build to Azure and there would be no reason to have Release Manager manage my enviornments.Ines
Then the basic problem is that your build isn't producing an appropriate artifact. I've updated my answer with some MSBuild arguments that should point you in the right direction.Hobbyhorse
My MSBuild arguments were as follows: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)"Ines
Thanks Daniel. I added the additional /p:OutDir=$(build.stagingDirectory) You had in your answer and have the same results. When I navigate for my web deploy package the available options from my artifact/drop is exactly like my code repo (see the last image in my post). I don't see any deployment packages. Even though I have a good build and it is linked as an artifact.Ines
I added an MSBuild task to my BUILD procedures along with your arguments and have updated my question above. I'm on the right path - but I can't get a proper artifact built for my RELEASE procedures to work with.Ines
I have the same problem: I cannot convince the "Copy Publish Artifact" to copy the zip file; from Visual Studio Build step logs I can see the that the zip is generated: 2015-12-03T10:12:17.1812334Z Package "ContactsList.API.zip" is successfully created as single file at the following location: 2015-12-03T10:12:17.1812334Z file:///C:/a/1/a/_PublishedWebsites/ContactsList.API_Package then Copy Publish Artifact is copying all files from C:\a\1\s\ to C:\a\1\a\drop\Kinesiology
I've fixed my problem by changing the Copy Root of the Copy And Publish task to $(Build.StagingDirectory) (the same value as the MSBuild parameter.Kinesiology

© 2022 - 2024 — McMap. All rights reserved.