TL;DR
dotnet add reference /Users/login/Projects/path-to-other-ref-folder/FolderName/newProjectToAdd.csproj
… from the directory of the csproj you want to add the reference to.
Today’s issue: Visual Studio is giving me some the type initializer for monodevelop threw an exception
whenever I open or try to create a new project.
Solution: Use VS Code for now (which I usually only use for TypeScript).
Issue #2: I need to add a reference to a local project.
Solution #2: dotnet add reference
-- hat tip to step 4 from here
It’s really that easy. I’m on macOS, so I cd
to the directory where the other csproj file lives.
Then I pwd
to get the full path.
mydrive:FolderName login$ pwd
/Users/login/Projects/path-to-other-ref-folder/FolderName
Go back to the location of the csproj you’re adding the reference to.
Now hit up add ref:
dotnet add reference /Users/login/Projects/path-to-other-ref-folder/FolderName/newProjectToAdd.csproj
And it’ll put it in that csproj, with a path relative to your current csproj.
<ItemGroup>
<ProjectReference Include="..\..\..\path-to-other-ref-folder\FolderName\newProjectToAdd.csproj" />
</ItemGroup>
That’s good enough for now. When I’m back in full VS mode with good net access, I’ll replace with a nuget, but this was a good temporary solution.
Keep on codin’…