Skip to content

Cake v6 - Packages imported inside sub scripts aren't being used in another script #4701

@jaimewukb

Description

@jaimewukb

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

6.0.0

Operating system

Linux

Operating system architecture

x64

CI Server

No response

What are you seeing?

Let say we have a script setup.cs that references another script context.cs

Inside context.cs we have imported some packages to use

#:package YamlDotNet@16.3.0
#:package Cake.Yaml@6.0.0
...

If this isn't also defined inside setup.cs then we get this error
The type or namespace name 'YamlDotNet' could not be found (are you missing a using directive or an assembly reference?)

What is expected?

We shouldn't need to also import

#:package YamlDotNet@16.3.0
#:package Cake.Yaml@6.0.0
...

In setup.cs

Steps to Reproduce

Create two files and make one reference the other one with the imported packages

Output log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions