I created 2 solutions:
Solution 1withConsole Application 1Solution 2withClass Library 2
Class Library 2 will be a helper used by several other solutions. I added the nlog library there:

I want the Console Application 1 project to use the functions from Class Library 2. As far as I know, I can do this in 2 ways:
- a) build
Class Library 2and add a reference to the .dll file generated after building the project in theConsole Application 1project - b) add the
Class Library 2project toSolution 1and then add a project reference toClass Library 2in theConsole Application 1project within the same solution
I prefer option b), which looks like this now:

The problem now is: When I use .NET Framework 4.8, when I open Solution 1, I see the following errors:
The name 'NLog' does not exist in the current context
Metadata file '...\Desktop\experiment\`.NET Framework 4.8`\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll' could not be found
The referenced component 'NLog' could not be found.
The solution to this is to open Solution 2 and build it. Then Solution 1 no longer shows any errors. When I do the same in .NET 8.0, there is no problem — there’s no need to build Solution 2.
I uploaded an example in both .NET versions here: https://github.com/westpop/experiment/tree/main
Does anyone have a solution for this? I know it’s an old version of .NET Framework, but I’m trying to manage it in legacy code — I don’t want to have to build all the other solutions. I want the projects to work “out of the box.” Overall, I have no idea why this doesn’t work — after all, what difference does it make whether I build the project from one solution or another?
It seems to me that the solution would be to also keep the packages folder in the repository, but that probably isn’t a good practice.