Sitelet https://github.com/fsprojects/Paket/issues/862
Skip to content

MSBuild build failure when license could not be downloaded #862

Description

@dmitryvk

I have a project that depends on DotNetZip.
DotNetZip's license URL (which is https://raw.github.com/had/DotNetZip.Semverd/develop/LICENSE) returns 404.
When restoring the packages during build, MSBuild tries to execute "paket restore ..." which downloads the package but MSBuild fails the build anyway with the following message:

The command ""C:\...\.paket\paket.exe restore --references-files "..." exited with code -1

This is the output of paket:

Paket version 1.11.1.0
Downloading DotNetZip 1.9.3 to C:\Users\user\AppData\Local\NuGet\Cache\DotNetZip.1.9.3.nupkg
Could not download license for DotNetZip 1.9.3 from https://raw.github.com/haf/DotNetZip.Semverd/develop/LICENSE.
    The remote server returned an error: (404) Not Found.
5 seconds - ready.

According to http://blogs.msdn.com/b/dsvc/archive/2012/02/29/output-from-exec-task-resulting-in-build-failure.aspx, MSBuild tries to match command output with several regexes to look for build errors (even when exit code is zero!).
It seems that MSBuild matches the string "error: (404) Not Found." (it even displays this error in "Errors List" window).

If I modify paket.targets file like this (note the IgnoreStandardErrorWarningFormat attribute) then build works fine:

...
  <Target Name="DownloadPaket">
    <Exec Command="$(DownloadPaketCommand)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(DownloadPaket)' == 'true' AND !Exists('$(PaketExePath)')" />
  </Target>
  <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
    <Exec Command="$(RestoreCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(PaketRootPath)" Condition="Exists('$(PaketReferences)')" />
  </Target>
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions