statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.65k stars 235 forks source link

Build failure on azure devops #858

Closed mfkl closed 5 years ago

mfkl commented 5 years ago

Hi,

Some recent unknown Azure Devops server-side change is failing my wyam build. Local build works. My config is probably not perfect, but I'm pretty sure a recent change on the azure devops side is triggering this since it worked fine before and I did not change anything.

The assembly 'Cake.Wyam, Version=2.2.4.0, Culture=neutral, PublicKeyToken=null' 
is referencing an older version of Cake.Core (0.28.0). 
For best compatibility it should target Cake.Core version 0.33.0.
D:/a/1/s/build.cake(52,9): error CS0012: The type 'Stream' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IO, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
D:/a/1/s/build.cake(52,9): error CS0012: The type 'Task<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Error: Error(s) occurred when compiling build script:
D:/a/1/s/build.cake(52,9): error CS0012: The type 'Stream' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IO, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
D:/a/1/s/build.cake(52,9): error CS0012: The type 'Task<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Those lines are

var netlifyToken = EnvironmentVariable("NETLIFY_TOKEN");
var client = new NetlifyClient(netlifyToken);
client.UpdateSite("mywebsite.netlify.com", MakeAbsolute(outputDir).FullPath).SendAsync().Wait();

Have a similar setup to your discoverdotnet website, wyam + cake + netlify. Currently using

#tool nuget:?package=Wyam&version=2.2.4
#addin nuget:?package=Cake.Wyam&version=2.2.4
#addin nuget:?package=NetlifySharp&version=0.1.0

I've seen https://github.com/Wyamio/Wyam/issues/324 and tried adding

#a System.IO
#a System.Threading.Tasks

to config.wyam but that didn't help.

Tried setting Verbose = true too but it doesn't get more verbose than that.

Still trying to troubleshoot this CI-only issue. Will keep you posted but if you have any hint, I'm all ears :)

Keep up the good work!

mfkl commented 5 years ago
**BUILD**
Loading configuration from file:///D:/a/1/s/config.wyam
Added known extension package Wyam.Yaml without version, setting version to [2.2.5]
Added known extension package Wyam.Markdown without version, setting version to [2.2.5]
Added known extension package Wyam.Razor without version, setting version to [2.2.5]
Installing NuGet packages
    Installing packages to C:/Users/VssAdministrator/.nuget/packages (using global packages folder)
    Writing packages file to D:/a/1/s/config.wyam.packages.xml
    Resolving package version for Wyam.Yaml [2.2.5, 2.2.5] (with dependencies)
      GET https://api.nuget.org/v3/registration3-gz-semver2/wyam.yaml/index.json
    Resolving package version for Wyam.Markdown [2.2.5, 2.2.5] (with dependencies)
      GET https://api.nuget.org/v3/registration3-gz-semver2/wyam.markdown/index.json
    Resolving package version for Wyam.Razor [2.2.5, 2.2.5] (with dependencies)
      GET https://api.nuget.org/v3/registration3-gz-semver2/wyam.razor/index.json
      OK https://api.nuget.org/v3/registration3-gz-semver2/wyam.razor/index.json 1208ms
      OK https://api.nuget.org/v3/registration3-gz-semver2/wyam.yaml/index.json 1708ms
      OK https://api.nuget.org/v3/registration3-gz-semver2/wyam.markdown/index.json 1232ms
    Installing package Wyam.Yaml 2.2.5

        Attempting to gather dependency information for package 'Wyam.Yaml.2.2.5' with respect to project 'C:/Users/VssAdministrator/.nuget/packages', targeting '.NETCoreApp,Version=v2.1'
          CACHE https://api.nuget.org/v3/registration3-gz-semver2/wyam.yaml/index.json
          GET https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/index.json
          OK https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/index.json 817ms
          GET https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/2.3.0-rc/3.9.0-pre239.json
          GET https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/3.9.0-pre240/4.1.1-pre0355.json
          GET https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/4.1.1-pre0356/6.1.1.json
          OK https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/3.9.0-pre240/4.1.1-pre0355.json 812ms
          OK https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/2.3.0-rc/3.9.0-pre239.json 813ms
          OK https://api.nuget.org/v3/registration3-gz-semver2/yamldotnet/page/4.1.1-pre0356/6.1.1.json 818ms
        Total number of results gathered : 3
        Gathering dependency information took 1.77 sec
        Summary of time taken to gather dependencies per source :
        https://api.nuget.org/v3/index.json -   1.72 sec
        C:/Users/VssAdministrator/.nuget/packages   -   0.06 ms
        Attempting to resolve dependencies for package 'Wyam.Yaml.2.2.5' with DependencyBehavior 'Lowest'
        Resolving dependency information took 0 ms
        Resolving actions to install package 'Wyam.Yaml.2.2.5'
        Resolved actions to install package 'Wyam.Yaml.2.2.5'
        Retrieving package 'Wyam.Yaml 2.2.5' from 'https://api.nuget.org/v3/index.json'.
        Retrieving package 'YamlDotNet 4.3.1' from 'https://api.nuget.org/v3/index.json'.
          GET https://api.nuget.org/v3-flatcontainer/wyam.yaml/2.2.5/wyam.yaml.2.2.5.nupkg
          OK https://api.nuget.org/v3-flatcontainer/wyam.yaml/2.2.5/wyam.yaml.2.2.5.nupkg 6ms
        Acquiring lock for the installation of Wyam.Yaml 2.2.5
        Acquired lock for the installation of Wyam.Yaml 2.2.5
        Installing Wyam.Yaml 2.2.5.
          GET https://api.nuget.org/v3-flatcontainer/yamldotnet/4.3.1/yamldotnet.4.3.1.nupkg
          OK https://api.nuget.org/v3-flatcontainer/yamldotnet/4.3.1/yamldotnet.4.3.1.nupkg 3ms
        Acquiring lock for the installation of YamlDotNet 4.3.1
        Acquired lock for the installation of YamlDotNet 4.3.1
        Installing YamlDotNet 4.3.1.
        Install failed. Rolling back...
        Executing nuget actions took 802.93 ms
    Exception while installing packages: NU3000: 
    Error while installing packages, attempting without remote repositories
    Installing package Wyam.Yaml 2.2.5
    Unexpected exception while installing packages: primarySources
    Error while installing packages, attempting to continue anyway
    NuGet packages installed in 5652 ms

Something is going wrong with installing from nuget apparently. Disabling the netlifysharp code reveals more errors during the script run

Line 19: CS0103: The name 'Yaml' does not exist in the current context
Line 20: CS0103: The name 'Markdown' does not exist in the current context
Line 24: CS0103: The name 'Razor' does not exist in the current context
Line 42: CS0103: The name 'Razor' does not exist in the current context
Line 48: CS0103: The name 'Razor' does not exist in the current context
Error while compiling configuration

FYI, I have not IgnoreDefaultSources set to true.

mfkl commented 5 years ago

using Cake.Tool seems to work around the issue.

dotnet tool install -g Cake.Tool
dotnet cake build.cake --target=****

Closing as its worked around.

daveaglick commented 5 years ago

Glad it's working now. There seems to be some sort of systemic NuGet issue that only appeared a couple months ago:

FYI - this sort of thing won't be a problem in Statiq since it doesn't directly install NuGet packages. And given how far along it is, it's unlikely any additional work will be done in Wyam to further address local package download problems directly.

daveaglick commented 5 years ago

FYI - I just pushed out a surprise version 2.2.7 of Wyam which should resolve most of these odd NuGet errors people have been seeing. It turns out the version of the NuGet API Wyam is using isn't keeping up with what's going on with package signing and there were incompatibility issues. It shouldn't have installation problems going forward.

If you're still seeing intermittent package installation failures or getting errors about not being able to find the recipe, give the latest version a spin.