Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 13, 2025

Fixes #44256

Summary

This PR addresses a documentation gap in the F# Interactive reference regarding the #i directive for specifying package sources. The documentation now clearly states that relative paths are not supported and provides comprehensive cross-platform examples.

Problem

Users were unclear whether relative paths work with the #i directive when specifying local package sources in F# Interactive. The documentation only showed a Windows absolute path example, leaving macOS and Linux users without guidance. For example, a user attempting to use:

#i "./my/local/packages"

would encounter an error with no explanation in the documentation about why this doesn't work or what the alternative is.

Changes

  1. Added cross-platform absolute path examples

    • macOS: /Users/username/path/to/my/local/source
    • Linux: /home/username/path/to/my/local/source
    • Maintained existing Windows and remote URL examples
  2. Added IMPORTANT callout clarifying that:

    • Relative paths aren't currently supported with the #i directive
    • Absolute paths must be used for local package sources
    • References tracking issue dotnet/fsharp#12969
    • Provides workaround using __SOURCE_DIRECTORY__ combined with System.IO.Path.Combine()
  3. Improved documentation quality

    • Used active voice and contractions for better readability
    • Fixed terminology (changed "package references" to "package sources")
    • Added ai-usage: ai-assisted frontmatter metadata
    • Updated ms.date to reflect current changes

Testing

Validated the behavior by testing F# Interactive:

  • ✅ Confirmed relative paths fail with "Invalid URI" error
  • ✅ Confirmed absolute paths work correctly across platforms
  • ✅ Verified documentation follows Microsoft style guidelines

Impact

This change directly answers the user's question and prevents confusion for developers trying to use local package sources in F# Interactive scripts on macOS and Linux. The documentation now provides clear guidance on what works, what doesn't, and why.

Original prompt

This section details on the original issue you should resolve

<issue_title>relative path for local package source - dotnet fsi (F#)</issue_title>
<issue_description>Hi i was trying to specify relative path on a mac for the package source in F# interactive (dotnet fsi), does that work or is there any workaround?

#i " ./my/local/packages"

Thanks,
have a great day


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Comments on the Issue (you are @copilot in this section)

@BillWagner ping @KathleenDollard @dsyme @BillWagner The docs should include a relative path example for `#i`. Alternatively, if relative paths aren't allowed, that should be stated.

Fixes #28973


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/fsharp/tools/fsharp-interactive/index.md docs/fsharp/tools/fsharp-interactive/index

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Oct 13, 2025
@Copilot Copilot AI changed the title [WIP] Fix relative path for local package source in dotnet fsi Document relative path limitation and add cross-platform examples for F# Interactive #i directive Oct 13, 2025
@Copilot Copilot AI requested a review from BillWagner October 13, 2025 18:39
Copilot finished work on behalf of BillWagner October 13, 2025 18:39
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is read for final review.

@BillWagner BillWagner marked this pull request as ready for review October 14, 2025 15:10
@BillWagner BillWagner requested review from a team as code owners October 14, 2025 15:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a documentation gap in the F# Interactive reference regarding the #i directive for specifying package sources. The main purpose is to clarify that relative paths are not supported and to provide comprehensive cross-platform examples for absolute paths.

Key changes:

  • Added explicit statement that relative paths aren't supported with the #i directive
  • Included cross-platform absolute path examples for macOS and Linux
  • Added workaround guidance using __SOURCE_DIRECTORY__ and System.IO.Path.Combine()

ms.date: 10/13/2025
f1_keywords:
- VS.ToolsOptionsPages.F#_Tools.F#_Interactive
ai-usage: ai-assisted
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition of the required ai-usage frontmatter for AI-assisted content.

Copilot generated this review using guidance from repository custom instructions.

### Specifying a package source

You can also specify a package source with the `#i` command. The following example specifies a remote and a local source:
You can also specify a package source with the `#i` command. The following examples specify a remote source and local sources on different operating systems:
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The phrase 'on different operating systems' is somewhat redundant since the examples themselves make this clear. Consider simplifying to 'The following examples specify remote and local sources:'

Suggested change
You can also specify a package source with the `#i` command. The following examples specify a remote source and local sources on different operating systems:
You can also specify a package source with the `#i` command. The following examples specify remote and local sources:

Copilot uses AI. Check for mistakes.

Comment on lines +188 to 189
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969). As a workaround, construct absolute paths programmatically using `__SOURCE_DIRECTORY__` combined with `System.IO.Path.Combine()`, and then manually specify the full absolute path in your script.
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround explanation could be clearer. The phrase 'and then manually specify the full absolute path in your script' is confusing since it suggests manual work after programmatic construction. Consider clarifying how users would actually implement this workaround with a brief code example.

Suggested change
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969). As a workaround, construct absolute paths programmatically using `__SOURCE_DIRECTORY__` combined with `System.IO.Path.Combine()`, and then manually specify the full absolute path in your script.
> Relative paths aren't currently supported with the `#i` directive. You must use absolute paths for local package sources. This limitation is tracked in [dotnet/fsharp#12969](https://github.com/dotnet/fsharp/issues/12969).
>
> **Workaround:** You can programmatically construct an absolute path using `__SOURCE_DIRECTORY__` and `System.IO.Path.Combine()`, then use string interpolation to pass it to the `#i` directive. For example:
>
> ```fsharp
> let localSource = System.IO.Path.Combine(__SOURCE_DIRECTORY__, "relative/path/to/my/local/source")
> #i $"""nuget: {localSource}"""
> ```
>

Copilot uses AI. Check for mistakes.

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

Labels

dotnet-fsharp/svc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

relative path for local package source - dotnet fsi (F#)

2 participants