Skip to content

.net core dll as a reference behaves differently from .net #25909

@ankgupta067

Description

@ankgupta067

create a .net standard dll , name it as Paas dll, and change the output path ..\Output\

add a class logger like below-

public class Logger 
    {
        public void LogMessage()
        {
            Console.Write("test");
        }
    }

Now create another .net core console project in solution and add dll as a refrence ( not project refrence) for pass.dll and make copy local to false.

Also change output directory of console app to ..\Output\

add below code in console app -

var logger = new Logger();
 logger.LogMessage();
 Console.Read();

Build and run .net core app, but now application goes in break mode with below error

Could not load file or assembly 'Paas, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

But if you perform same steps with .net framework 4.6.1 projects it works, why this different behavior with .net core exists and how to fix it?

Github project for more clarity -
https://github.com/ankgupta067/DependencyInjection

[EDIT] Change code & exception formatting by @karelz

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions