Description
I am attempting to prepare a dotnet monorepo, part of which is defining strict standards for how projects refer to each-other for parsing and portability purposes. The standard we have decided on is defining a $(LibDir)
property in a top level Directory.Build.props
file, and referring to projects relative to this property.
<ProjectReference Include="$(LibDir)\SomeLibrary\SomeLibrary.csproj"/>
To assist in enforcing this, tasks for adding a reference to a project which prompt the user for a project name and executes the appropriate dotnet reference add
command.
There are two issues with this approach.
First, that dotnet reference add --project "path/to/project.csproj" "$(LibDir)\SomeLibrary\SomeLibrary.csproj"
does not take into account the fact that, in context, such a project reference is valid:
Could not find project or directory `$(LibDir)/SomeLibrary/SomeLibrary.csproj`.
Second, that dotnet reference add
does not have a --force
argument or similar to insert the reference regardless of validity.