dotnet Verified current stable Not installed? Programming

Dotnet / Add Multiple References Current Directory

Add Multiple References Current Directory

Add multiple project references to the current .NET project.

$
Terminal
dotnet add reference <path/to/reference1.csproj path/to/reference2.csproj ...>

When To Use

When establishing several dependencies concurrently during project initialization.

Pro Tip

Avoid version conflicts by reviewing dependency compatibility between referenced projects before adding them.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
dotnet add reference <path/to/reference1.csproj path/to/reference2.csproj ...>

Anatomy of Output

Understanding the result

2 references added: FirstLib, SecondLib. Reference Status

Confirms the count of added references.

Project restored. Restore Status

Indicates whether restoration happened automatically.

No changes made to project file. File Status

Denotes if existing references were updated.

Troubleshooting

Common pitfalls

Error: One or more specified references do not exist

Solution: Double-check paths for accuracy and existence.

Error: Unsupported project type for one or more references

Solution: Verify the project types of all references are compatible.

Error: Duplicate references are not allowed.

Solution: Remove any already existing reference before re-adding.

Command Breakdown

What each part is doing

dotnet
Base Command
The executable that performs this operation. Here it runs Dotnet before the shell applies any redirect operators.
<path/to/reference1.csproj path/to/reference2.csproj ...>
path to reference1.csproj path to reference2.csproj ...
The value supplied for path to reference1.csproj path to reference2.csproj ....

Alternative Approaches

Comparable commands in other tools

Alternative programming tools for the same job.