could not load or find assembly Microsoft.Azure.cosmos.table


I have a windows forms application WinFormsProj, which references a class library project named ModelsProj.
ModelsProj has dependency to Microsoft.Azure.Cosmos.Table version
At runtime, when WinFormsProj reaches this code, raises a FileNotFoundException saying that could not load or find assemble Microsoft.Azure.Cosmos.Table`:

var entityTypes = typeof(EntityBase).Assembly.GetExportedTypes()
            .Where(t => t.GetInterface(typeof(IDto).FullName) == null
                        && t.GetInterface(typeof(IEntity).FullName) != null && !t.IsAbstract);

EntityBase is the base type of all of my model entities, and is located in ModelProj.

I can solve the exception by just adding a reference to Microsoft.Azure.Cosmos.Table in WinFormsProj.
However, I expect the program work without doing this! My question is : Why isn't the dll of Microsoft.Azure.Cosmos.Table getting copied to the output? Isn't the build process supposed to put all the needed dlls in output directory?

I've found here that a common cause is that a project and one if its dependencies, depend on different versions of the same package. That is not my case, WinFormsProj does not need to reference any version of Microsoft.Azure.Cosmos.Table itself!

further info: I've used fuslogvw.exe to inspect what happens and here is its log:

*** Assembly Binder Log Entry  (8/12/2020 @ 10:25:22 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  H:\melkradar-git\melkradar\src\MelkRadar\Mgmt\MelkRadar.Mgmt.Win\bin\Debug\MelkRadar.Mgmt.Win.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Azure.Cosmos.Table, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Appbase = file:///H:/melkradar-git/melkradar/src/MelkRadar/Mgmt/MelkRadar.Mgmt.Win/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MelkRadar.Mgmt.Win.exe
Calling assembly : MelkRadar.Core.Model, Version=, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file: H:\melkradar-git\melkradar\src\MelkRadar\Mgmt\MelkRadar.Mgmt.Win\bin\Debug\MelkRadar.Mgmt.Win.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Azure.Cosmos.Table, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///H:/melkradar-git/melkradar/src/MelkRadar/Mgmt/MelkRadar.Mgmt.Win/bin/Debug/Microsoft.Azure.Cosmos.Table.DLL.
LOG: Attempting download of new URL file:///H:/melkradar-git/melkradar/src/MelkRadar/Mgmt/MelkRadar.Mgmt.Win/bin/Debug/Microsoft.Azure.Cosmos.Table/Microsoft.Azure.Cosmos.Table.DLL.
LOG: Attempting download of new URL file:///H:/melkradar-git/melkradar/src/MelkRadar/Mgmt/MelkRadar.Mgmt.Win/bin/Debug/Microsoft.Azure.Cosmos.Table.EXE.
LOG: Attempting download of new URL file://

BTW, I've tried cleaning the solution, restarting VS, rebuilding and trying again, suggested in similar questions. it didn't work.


0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0