The name 'Program' does not exist in the current context in core

name meanings
first name meanings
behind the name search
in the name of love
name generator
in the name of movie
baby names
behind the name generator

I'm trying to make a simple test so I can practice. I don't know what I'm doing wrong, but I get

The name 'Program' does not exist in the current context [/dir/unitTestTest/unitTestTest.csproj]

And I don't know why. Here is my code.

I have a Program.cs

using System;

namespace unitTestDotNet
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World!");
            int yy = Add(2,1);


        public static int Add(int x, int y) 
            return x + y;

        public static bool IsOdd(int value) 
            return value % 2 == 1;


using Xunit;

public class testclass 
    public void PassingAddTest()
        Assert.Equal(4, Program.Add(2,2));


And in the unitTestProject.csproj

<Project Sdk="Microsoft.NET.Sdk">
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1"/>
    <PackageReference Include="xunit" Version="2.4.1"/>
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"/>

I'm new to core and I don't know what I'm doing wrong

Change your Program class visibility to public and be sure you have correct project reference from UnitTest-project to project where public class Program is.

Browse Names, Lists of given names organized by letter, gender, language and more. Search for ustekinumab plaques psoriasis patient options. Top Psoriasis Treatments

The Program class should be declared as public if you want to access it in another class. All classes default to internal, while members default to private.

Name, A name is a term used for identification. They can identify a class or category of things, or a single thing, either uniquely, or within a given context. The entity� Search for grill cover. Top Savings On Grill Covers

Although the answers about the visibility are correct when testing, in your case the testclass was outside the same namespace as your Program.

Take a look at to learn more about testing and good practices.

Where the name 'Isaias' comes from and how to pronounce it, Isaias is teetering on the border between hurricane and tropical storm, and it's about to drop serious rain on the Southeast and the D.C. area. This name was used in this spelling by William Shakespeare for a character in his comedy Twelfth Night (1602). This was a rare name in Shakespeare's time that may have been based on OLIVA or OLIVER, or directly from the Latin word oliva meaning "olive".

The Name Jar: Choi, Yangsook, Choi, Yangsook: 9780440417996 , Being the new kid in school is hard enough, but what about when nobody can pronounce your name? Having just moved from Korea, Unhei is anxious that� A name is much more than just a name! Hidden within your name is a SPECIAL meaning. Search over 5 MILLION records.

Guidance for Industry: The Seafood List, The use of acceptable market names is essential in the identification of seafood because of the exceptional number and variety of species represented by this� Name definition, a word or a combination of words by which a person, place, or thing, a body or class, or any object of thought is designated, called, or known. See more.

In the name of, In the name of definition at, a free online dictionary with pronunciation, synonyms and translation. Look it up now! Lists of given names organized by letter, gender, language and more.

  • Are the test and the program in the same project?
  • This is basic C# - you have to have a reference to the project, and you have to either bring the namespace into scope via a using statement (using unitTestDotNet; or using a fully qualified name (unitTestDotNet.Program.Add(2,2)). And your class needs to not be private.
  • Yes, there are in the same project
  • Are you sure they're in the same project? Because it looks to me like you have a console project, and a unit test project. They might be in the same solution, but they're likely not the same project. If your unit test project is going to use code from your console project, it needs to have a reference to your console project.
  • Also, looks like your test is outsite the same namespace of your Program.
  • Classes default to internal, not private. Class members do default to private.
  • You're right, actually it's not possible to declare a type member of an namespace as private:….