简体   繁体   中英

'Could not load file or assembly', dll reference asp.net core 2 application

I'm having reference errors when running my asp core 2 web application. My web (core 2) project is referencing another (.dll output) project (.net 4.7) which has Windsor.Core and windsor.castle nuget packages installed. When running the web project, I get the following error:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Castle.Windsor, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'. The system cannot find the file specified.'

Both projects are targeting x64 (needed for another library). The properties of the Windsor.Core and castle dll's:

在此处输入图片说明 在此处输入图片说明

The Windsor libraries are added to the .dll project only. When I also add the same nuget packages to the asp.net core project, the program crashes with following message:

System.MissingMethodException: 'Method not found: 'Castle.MicroKernel.Registration.IWindsorInstaller Castle.Windsor.Installer.FromAssembly.This()'.'

which to me, seems like only a part of the library is loaded.

Both Windsor.Castle / Core libraries can be found in the output directory of the asp.net core 2 web application. But why can't it find it?

User AsifAli72090 was right, I also thought something like that would be the problem but my google results didn't give me that answer.

I fixed the problem by creating a new .net core dll project in my solution and moved all of my files to there. You can google on how to convert to a .net core project, but it's not as easy as checking or switching a dropdown in the settings. Everything worked flawlessly then!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM