Similar questions have been addressed here, here, etc., but they all refer to problems with external references. In my solution I want to make a reference from one C# project to another, so the output of projectB
is available in the output of projectA
(Copy Local: yes). However, as ProjectB
is listed in projectA
dependencies, it's listed with a warning yellow triangle:
The first project in the "Projects" branch is a library, but the second project (the would be ProjectB
) is a .Net console executable from which I don't require anything but the executable itself.
I'm guessing VS2019 is complaining because I'm not exporting anything from the ProjectB
assembly, so nothing can be imported into ProjectA
. The same behavior happens if ProjectB
is a C++ project.
My question is: is there a better way to reference one project from another, so the referenced project is compiled and copied into the other project's output directory? (I mean, without resorting to ugly hacks like making ProjectB
's output dir the same as ProjectA
's or adding custom steps to ProjectB
).
Please note that my current configuration works as intended, except for the annoying/misleading warning icon in the browser.
This is how ProjectB
is referenced from ProjectA.csproj
:
<ProjectReference Include="..\ProjectB\ProjectB.csproj">
<Private>true</Private>
</ProjectReference>
EDIT: Added clarification about custom step.