Microsoft Visual Studio: System.IO.FileNotFoundException in Console App that references Library that should have the File in question

0

I created a c# Library class (called IfcManagerLib) in Visual Studio and installed some packages (only on the library) via the NuGet Packages Manager. Now I want to use this library through a Console App (called IfcManagerConsole), so I created one in the same solution, added a reference to IfcManagerLib and added "using IfcManagerLib;" on the top of the console class. However, if I start the console it always breaks at the moment it tries to execute something from the library class. It outputs the following error:

System.IO.FileNotFoundException HResult=0x80070002 Message=Die Datei oder Assembly "Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. Source=IfcFileManagerLib
StackTrace: at IfcFileManagerLib.IfcManager.Start() in C:\Users\David\Dropbox\Visual Studio\source\repos\IfcFileManager\IfcFileManagerLib\IfcManager.cs:line 101 at IfcFileManagerConsole.Program.Main(String[] args) in C:\Users\David\source\repos\IfcFileManager\IfcFileManagerConsole\Program.cs:line 36

Inner Exception 1: FileNotFoundException: Die Datei oder Assembly "Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

(Sorry, some of it is in German, but I think you mostly know what it is supposed to say)

What really bothers me, is that the path to the IfcManagerLib (C:\Users\David\Dropbox\Visual Studio\source\repos\IfcFileManager\IfcFileManagerLib\IfcManager.cs) in the above error message is not correct. It is an old path. I rebuilt the solution, unistalled and reinstalled all packages, but the error still exists. Also: "Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0" is not correct, I updated it to 2.2.0.0.

Am I correct in the asumption that the console project does NOT need to have the packages installed that the library uses? If yes, what did I do wrong?

EDIT: Okay. Cleaning and rebuilding the solution did a lot already. However, there is one dll called Xbim Geometry that the Console still cannot find. Here is the error message:

System.IO.FileLoadException HResult=0x80131621 Message=Failed to load Xbim.Geometry.Engine64.dll Source=Xbim.Geometry.Engine.Interop StackTrace: at Xbim.Geometry.Engine.Interop.XbimGeometryEngine..ctor(ILogger`1 logger) in C:\buildagent_os_work\1\s\Xbim.Geometry.Engine.Interop\XbimGeometryEngine.cs:line 65 at Xbim.ModelGeometry.Scene.Xbim3DModelContext.get_Engine() in C:\buildagent_os_work\1\s\Xbim.ModelGeometry.Scene\Xbim3DModelContext.cs:line 486 at Xbim.ModelGeometry.Scene.Xbim3DModelContext.CreateContext(ReportProgressDelegate progDelegate, Boolean adjustWcs) in C:\buildagent_os_work\1\s\Xbim.ModelGeometry.Scene\Xbim3DModelContext.cs:line 678 at IfcFileManagerLib.IfcManager.Start() in C:\Users\david\source\repos\IfcFileManager\IfcFileManagerLib\IfcManager.cs:line 82 at IfcFileManagerConsole.Program.Main(String[] args) in C:\Users\david\source\repos\IfcFileManager\IfcFileManagerConsole\Program.cs:line 36

Inner Exception 1: FileNotFoundException: Die Datei oder Assembly "Xbim.Geometry.Engine.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.

What I find odd is that unlike the other dlls that I installed on the library project through NuGet manager, the XbimGeometry dll is located in two folders named x64 and x86 where there is a 64-bit and a 32-bit version. Could that be the problem?

c#
visual-studio
reference
filenotfoundexception
asked on Stack Overflow Dec 20, 2018 by Truning • edited Dec 22, 2018 by Truning

1 Answer

0
  1. Can you do a clean solution and rebuild the solution.
  2. Can you set the reference as Project reference and set "Copy Local" for that reference?
answered on Stack Overflow Dec 20, 2018 by Fagun • edited Apr 10, 2019 by marc_s

User contributions licensed under CC BY-SA 3.0