Could not load file or assembly 'Interop.ADOX - c#

I am adding reference to Interop.ADOX.dll in my class library project "ABCD" in C#. When I built the project it builds fine. I can also access classes and functions provided by Interop.ADOX.dll.
But when I run the exe which uses my dll "ABCD", it throw error :
"Could not load file or assembly 'Interop.ADOX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
I tried creating a separate sample class library and adding reference to the Interop.ADOX.dll and that works fine. No errors. So there is nothing wrong with the Interop.ADOX.dll file.
Also I know somehow in my project structure it is not able to find the Interop.ADOX.dll file and hence unable to load it.
So far I tried copying them at all the possible locations that I thought it might be
trying to access it from but that did not work...
Any suggestions that I can try out?
I found out something. In the project properties, Build Tab, when I chose platform target as any CPU then it throws error. But if I chose x86 it works fine. Why?

Related

Could not load file or assembly C# Console Application with Class Library

I've created a Class Library in C# .Net Framework 4.8, and in the solution I've also included a Console Application, same target.
I'm running both in a x64 configuration.
No errors on build.
I referenced the App in the Library, and when I run a Button in a Form in the Class Library I'm getting an error:
System.IO.FileNotFoundException: Could not load file or assembly
'ExampleApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The system cannot find the file specified.
File name: 'ExampleApp, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'
I've combed the internet and SO for a solution. I tried repairing Visual Studio, I tried deleting the .vs folder in the projects, I tried things like:
solution 1
and
solution 2
I seriously tried everything I could think of. It has to be something to do with the .dll dependencies imho, because the only one that my ExampleApp is using is the Microsoft.CognitiveServices.Speech reference which I installed via NugetPackage in my solution.
No idea how to debug this further or get a proper trace stack from this error...
Any ideas on how to proceed?
Thanks
Solved by changing the .dll's Copy Local property to True
Exactly #Yafim Simanovsky, I solved also my problem by changed <Private> flag to True.
My problem (“Could not load file or assembly…”) was with new Designer ‘WpfSurface.exe’ from VS 2022, which after changing the reference tags ‘Private’ to True, was able to copied all dependent .dll files to Cache.

Could not load file or assembly 'Microsoft.Practices.ObjectBuilder2, Version=2.2.0.0, Culture=neutral

My application is running fine on local, after i publish to azure web apps it gives me the error
Could not load file or assembly 'Microsoft.Practices.ObjectBuilder2, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
how do I fix this? I do not even have the objectBuilder2, if its something I have to reference where do I get it?Please help
Microsoft.Practices.ObjectBuilder2 is part of Enterprise Library. See here
Do you use this library? If not, try to remove references to it. If you use it, then add appropriate .dll to your installation.
For me Microsoft.Practices.Unity references was broken. I've just removed and added it again and worked. Maybe any refereces to Microsoft.Practices.* that would be broken can show this error.
Place Microsoft.Practices.ObjectBuilder2.dll in bin folder of your web application, this will work.

Compiled program searching for and not finding project which is part of solution

I've created a commandline program which I'm compiling and executing. So far so good.
The solution consists of 2 projects. The main project and the data project (with the main project being the executeable and startup proejct and the data project handling the sql connections).
It works fine BUT: Whenever I move the .exe out of the folder it has been created in it tries to find the data project and fails to do so and thus the execution of the .exe fails.
The error message is:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or
assembly 'Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The system cannot find the file specified.
at MyProject.Program.Main(String[] args)
I've never encountered this problem before as both projects are part of the same solution and in the compile folder it works.
Anyone can give me a hint as towhat could be the cause here?
Notes: The project itself has the default settings as has the solution.
Also like mentioned I have never encountered such a problem before as normally I only just move the .exe and don't need to also move (separately) the .dll of the other projects. At least I never consciously encountered this problem before there. If I included external projects then yes then it was necessary to also have the .dll there if I said reference by copy. But in this case its a second project of the same solution and there I never had this before.

C# Could not load file or assembly Interop.InetCtlsObjects

I've upgraded a VB6 project to C# and I'm trying to run a winforms project and I have the Interop.InetCtlsObjects.dll file in my project and I've added a reference to it, but when I'm trying to run it I'm getting this error:
Could not load file or assembly
'Interop.InetCtlsObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies.
The system cannot find the file specified.
But I can see the file and I added a reference to it's exect location...
So what am I missing here ???
Delete the reference, save the project and add it in again. It is possible that you are somehow referencing a different version and the compiler cannot find the right DLL because of it. If that doesn't work, check your app.config and make sure the versions for this particular DLL match.

C# project with Interop.ComUtilitiesLib.dll issue

I downloaded an open source project written in C# and I can build that project. However, I got the error like this during run time:
Could not load file or assembly 'Interop.ComUtilitiesLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
This means it couldn't load the Interop.ComUtilitiesLib.dll file, I have checked in project root directory as well as in the Window/System32, still couldn't find the Interop.ComUtilitiesLib.dll file.
Any suggestion for me to fix this problem!
Does the project include a ComUtilities.dll file? If so, it might be a COM object that needs to be registered via the command line:
regsvr32 ComUtilities.dll

Categories

Resources