Build from Source Control using Azure DevOps fails - Nuget package created with 0 bytes.

Hi everyone, 

Recently our builds on Azure DevOps started to fail with the following error message:

##[error]Cannot generate NuGetPackage. File path: C:\windows\ServiceProfiles\NetworkService\AppData\Local\Temp\DLM Automation\

The NuGet package (artifact) is created but it's empty (0 bytes).

Thanks in advance!

Log output on the build step:

  1. Starting: Build DBPackage
    ==============================================================================
    Task : Redgate SQL Change Automation: Build
    Description : Build and test databases with Redgate SQL Change Automation
    Version : 4.0.1
    Author : Redgate Software
    Help : [More Information](https://www.red-gate.com/sca/ps/help)
    ==============================================================================
    Setting ErrorActionPreference to "Stop" because no -ErrorAction argument was provided
    New-DatabaseConnection, SQL Change Automation 4.2.20112.19442, Copyright © Red Gate Software Ltd 2014-2019
    Use of this functionality requires a SQL Toolbelt license.
    If you are unsure of your current user license entitlement please contact licensing@red-gate.com
    Invoke-DatabaseBuild, SQL Change Automation 4.2.20112.19442, Copyright © Red Gate Software Ltd 2014-2019
    Cleaning database 'XXX_Test_CI' on server 'XXX'.
    Validating SQL Source Control project 'C:\Agents\Agent1\_work\1\s'.
    Schema validation successful.
    New-DatabaseBuildArtifact, SQL Change Automation 4.2.20112.19442, Copyright © Red Gate Software Ltd 2014-2019
    Export-DatabaseBuildArtifact, SQL Change Automation 4.2.20112.19442, Copyright © Red Gate Software Ltd 2014-2019
    .\db\state\.git\objects\pack\pack-4025e9990e6c431fcbee6c6b4eb1087d2fb92e3c.pack
    ##[error]Cannot generate NuGetPackage. File path: C:\windows\ServiceProfiles\NetworkService\AppData\Local\Temp\DLM Automation\pumhamrk.0o4. Package: DBPackage. Version: 1.0.35869, Description: .
    Finishing: Build DBPackage
Tagged:

Answers

  • Hi @Lucian sorry to hear you're getting an issue with your build task with SQL Change Automation! I'm going to need some more detailed logs etc, what I'll do is reach out to you via a support ticket and we can investigate from there!

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

  • LucianLucian Posts: 5 Bronze 1
    Thanks @Dan for your help. I think we managed to make it work using the previous version of the Azure DevOps Task version 3.*.


  • SzymonOsSzymonOs Posts: 8 New member
    We have similar problem.
    Export-DatabaseBuildArtifact, SQL Change Automation 4.2.20119.19650, Copyright © Red Gate Software Ltd 2014-2019
    .\db\state\.git\objects\pack\pack-d5a74b84a2ec9b4be0ee3e4a1a7df1d3075a3379.pack
    ##[error]Cannot generate NuGetPackage. File path: C:\Users\VssAdministrator\AppData\Local\Temp\DLM Automation\21pidr4p.pjo. Package: XXX. Version: 20.05.01.2, Underlying error: Can not access a closed Stream..

    Problem exists on our 2 biggest databases (~7000 and ~14000 objects), on databases smaller than 3000 objects nuget is created successfuly.

    Using task version 3.* solves above problem, but I would prefer using 4.* accross all builds.
  • SamTouraySamTouray Posts: 13 Bronze 2
    edited May 5, 2020 12:35PM
    We had the same issue:

    Export-DatabaseBuildArtifact, SQL Change Automation 4.2.20119.19650, Copyright © Red Gate Software Ltd 2014-2019
    .\db\state\.git\objects\pack\pack-b5ae9c2c642d9f0554a0c735413733be13335d83.pack
    ##[error]Cannot generate NuGetPackage. File path: C:\Users\User1\AppData\Local\Temp\DLM Automation\ocohjn0z.s5o. Package: MyDatabase. Version: 1.0, Underlying error: Can not access a closed Stream..

    In our case we are using Git for source control and our database scripts folder is in the VCS root, so it was attempting to include the .git folder in the generated NuGet package. Our .git folder was 60.8 MB!

    I solved it by adding a task to delete the .git folder.  I found out that it includes the .git folder by trying it on another source controlled database with a smaller .git folder and the generated NuGet package includes everything in the source folder, not just *.sql files. You can see this yourself by changing the extension of the NuGet package to .zip and opening in Windows Explorer.

    I am planning to move our database scripts folder to a sub-folder of the VCS root and then we won't need a task to delete the .git folder. Also, it's just a cleaner solution as we are then free to store other files/folders in our VCS root and they won't affect database package creation.
  • DanCDanC Posts: 637 Gold 5
    edited May 5, 2020 1:15PM
    Hi @muscimol & @SamTouray

    Just to keep you in the loop there's currently an issue in version 4.* where if a NuGet package exceeds a certain size it's causing failure, it's currently being investigated by the team with the bug reference: SCA-2717. As mentioned above by other customers discoveries, the current workaround is to use version 3.*

    Hope this helps clear up the situation and we will do our best to let you know when a fix comes around! 

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

Sign In or Register to comment.