fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

generate_load_scripts sub.group.fsx dependencies out of order #2911

Open TheAngryByrd opened 6 years ago

TheAngryByrd commented 6 years ago

Description

I have a build dependency group as such

group build
  generate_load_scripts: true
  framework: >= net45
  source https://nuget.org/api/v2
  nuget Http.fs
  nuget FAKE

When paket generates the build.group.fsx it gives

#r "../../../../packages/build/Http.fs/lib/net40/HttpFs.dll" 
#r "../../../../packages/build/Hopac/lib/net45/Hopac.Core.dll" 
#r "../../../../packages/build/Hopac/lib/net45/Hopac.Platform.dll" 
#r "../../../../packages/build/Hopac/lib/net45/Hopac.dll" 

However HttpFs is dependent on Hopac as seen in the Http.fs.fsx script:

#load @"Hopac.fsx" 
#r "../../../../packages/build/Http.fs/lib/net40/HttpFs.dll" 

So when trying to use it in a FAKE script

#load @"./.paket/load/net462/build/build.group.fsx"

I end up with the error:

build.fsx(14,12): error FS0074: The type referenced through 'Hopac.Alt`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'Hopac.Core'

Repro steps

https://github.com/TheAngryByrd/paket-generate-out-of-order/

Expected behavior

Either generates the dependency order correctly or delegates to calling load on direct dependencies

Actual behavior

Generates correct dependency order

Known workarounds

Calling load on things within the group directly such as:

#load ./.paket/load/net462/build/Http.fs.fsx
enricosada commented 6 years ago

i can repro in FSAC

otto-gebb commented 6 years ago

I encountered this, too, when editing a FAKE script referencing Http.fs.

The workaround was to edit the file ./.fake/build.fsx/intellisense_lazy.fsx manually and move the line

#r "../../packages/fakebuild/Http.fs/lib/net471/HttpFs.dll"

after the line

#r "../../packages/fakebuild/Hopac/lib/net471/Hopac.dll"
halcwb commented 5 years ago

This is an old problem, but still relevant. I encountered this problem also in other generated references tools. Recently I ran into this using canopy. Canopy relies on Selenium.WebDriver, so this should be the correct order in the generated group.fsx:

#r "../../../../packages/uitests/Selenium.WebDriver/lib/net45/WebDriver.dll"
#r "../../../../packages/uitests/canopy/lib/netstandard2.0/canopy.dll"

Suppose, this issue is bigger than Paket.