C# add reference under specific folder issue

Viewed 30

I'm using Visual Studio 2019 Community Edition. After I added the reference under subdir with copy local set to true, it works fine, then I modified the app.config to

<?xml version="1.0" encoding="utf-8" ?>


<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <probing privatePath="Mylib\"/>
        </assemblyBinding>
    </runtime>
</configuration>

thinking this may not require copy to local anymore, then I got

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Isn`t this the proper way to add subdir reference? (By the way, there is only *.dll.config but not *exe.config generated when I added item 'App.config' )

1 Answers

I finally found out that the problem here is the project type part, it seems that .net core does not support these traits, so I changed my project to console(.netframework) then the modifying app.config route works.

Related