How do you link with another project in .net

Viewed 160

How do I link with another project in .netcore?

I'm using Linux and VSCode and I want to link to another project that is in another directory on my filesystem, so that when my project compiles it knows to look in that path for the approriate binaries. What should I add to my *.fsproj?

Note I'm using F# but the question is language agnostic. The same thing you might do in C# should work.

1 Answers

See dotnet add reference command which adds a reference between projects

The dotnet add reference command provides a convenient option to add project references to a project. After running the command, the elements are added to the project file.

<ItemGroup>
  <ProjectReference Include="app.csproj" />
  <ProjectReference Include="..\lib2\lib2.csproj" />
  <ProjectReference Include="..\lib1\lib1.csproj" />
</ItemGroup>

Hth.


See also the official Microsoft tutorial Get started with F# with the .NET Core CLI which mentions this in a larger context.

Related