Unable to find type [namespace.className]

Viewed 103

While executing [General.Program]::Main() command in the powershell. It gave below error.

Unable to find type [General.Program].
At line:1 char:1
+ [General.Program]::Main()
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (General.Program:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound

Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace General
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Calculate(10);
        }
        public static int Calculate(int value)
        {
            Console.WriteLine($"Hello: The value is {value}");
            return value;
        }
    }
}

Commands which is used in powershell window are as follows

dotnet run -v m
[Reflection.Assembly]::LoadFrom((Resolve-Path .\bin\Debug\netcoreapp3.1\General.dll).path)
[General.Program]::Main()

Attaching the screenshot enter image description here

Folder structure enter image description here

0 Answers
Related