Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Using Visual Studio 2019
Building console app solution

I have a solution with the following assemblies:

- ConsoleAppCore - console app targeting .Net Core 5.0
- ConsoleAppFrame - console app targeting .Net Framework 4.7.2
- Common - library assembly targeting .Net Standard 2.0

If I add a reference for Common to ConsoleAppCore, everything is okay.

If I add a reference for Common to ConsoleAppFrame, the namespace in the Common assembly won't resolve when I add the appropriate using statement.

Am I not understanding what .Net Standard is for? Is it more involved than what I'm assuming I should do?

(Notice I'm using .Net Framework 4.7.2 which is supposed to be "fully compatible" with .Net Standard 2.0.)

What I have tried:

I tried using the .Net Standard assembly in a .Net Framework app, and my life sucks as a result.
Posted
Updated 5-Nov-21 0:48am

1 solution

Right after I posted this, I found the answer.

When I originally created the Common assembly, I targeted .Net Standard 2.1 (thinking the newest is the best way to go).

While googling my problem, I found out that .Net 4.7.2 only supports Standard 2.0, so I changed the Common project, and it did not resolve the namespace resolution problem. This is the point at which I posted this question.

When I went back to the code, I removed the old reference, and re-added it, and everything is now resolving correctly.

I would think that in 2021, Visual Studio would just "do the right thing" (TM), and everything would just work.

I hate Microsoft's half-assed tools.
 
Share this answer
 
Comments
PIEBALDconsult 5-Nov-21 10:45am    
Please don't try to answer your own question; just add it to the question.

(Ducking.)
#realJSOP 5-Nov-21 11:02am    
It's the best way to keep people from trying to answer a question that has been solved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900