Skip to content

dotnet reference add gives "Could not find project or directory ``." #49281

@ndchorley

Description

@ndchorley

I'm using the .NET SDK on a Mac:

$ dotnet --version
9.0.300

I'm trying to follow this guide to creating unit tests with F#. Everything works, up until the use of dotnet reference add:

$ dotnet reference add ../MathService/MathService.fsproj
Could not find project or directory ``.

The directory structure I've ended up with:

$ tree

.
├── MathService
│   ├── Library.fs
│   ├── MathService.fsproj
│   └── obj
│       ├── MathService.fsproj.nuget.dgspec.json
│       ├── MathService.fsproj.nuget.g.props
│       ├── MathService.fsproj.nuget.g.targets
│       ├── project.assets.json
│       └── project.nuget.cache
├── MathService.Tests
│   ├── MathService.Tests.fsproj
│   ├── obj
│   │   ├── MathService.Tests.fsproj.nuget.dgspec.json
│   │   ├── MathService.Tests.fsproj.nuget.g.props
│   │   ├── MathService.Tests.fsproj.nuget.g.targets
│   │   ├── project.assets.json
│   │   └── project.nuget.cache
│   ├── Program.fs
│   └── UnitTest1.fs
└── unit-testing-with-fsharp.sln

dotnet reference add --help says:

$ dotnet reference add --help
Description:
  Add a project-to-project reference to the project.

Usage:
  dotnet reference add <PROJECT_PATH>... [options]

Arguments:
  <PROJECT_PATH>  The paths to the projects to add as references.

and I'm providing a path, so I don't understand what's wrong. I am new to the .NET ecosystem, but it looks like a bug to me.

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