C# reference

vick myers 0 Reputation points
2023-03-28T17:51:29.9933333+00:00

I created a very simple console app with a library that I am having problems referencing from the console app to the library.

You can see by the picture that everything is set up I think correctly and there is a reference to the library. 

When I hover over the red line it shows the air cs0246 the type or namespace name car could not be found are you missing a using directive or an assembly reference? in the picture I hit previous change and this is what you see. 

I must be overlooking something but cannot figure it out.

 I am using visual studio 2019, a standard classic 2.1 Library and a console app framework 3.1

User's image

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,055 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,855 questions
{count} votes

4 answers

Sort by: Most helpful
  1. vick myers 0 Reputation points
    2023-03-28T19:06:02.2166667+00:00

    Thank you RLWA32: Yes for the Car in a namespace but it doesn't help

    User's image


  2. Bruce (SqlWork.com) 64,481 Reputation points
    2023-03-28T21:23:29.1133333+00:00

    has OldCarLibrary built without errors? try a rebuild


  3. Karen Payne MVP 35,401 Reputation points
    2023-03-28T23:48:14.4+00:00

    The easy fix is to have all projects use the same .NET Framework rather than one classic and one .NET Standard. So one of them needs to be recreated to match the other project framework.


  4. RLWA32 45,236 Reputation points
    2023-03-29T08:07:16.8933333+00:00

    The real problem is that .Net Standard 2.1 is not supported by the .Net Framework. Refer to https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1. However, if you target your class library to .Net Standard 2.0 then it can be consumed without problem by a .Net Framework application. The supported versions of the .Net Framework are documented at https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.