LinqPad6 Can't Load Assembly to Connect to My Project - c#

Following the instructions at LinqPad's site, I tried to create a connection directly to my EntityFrameworkCore project.
As per the instructions, I entered the path to the project's dll in the .\obj directory. I then tried to enter the path either to my DbContext file, or to the cs file. In every case, I get a "Cannot load assembly" error.
Here's a screencap:
The couple of MS packages mentioned in the error message are all installed in the application. I haven't found anything in the LinqPad forums, so I'm hoping someone here can help.
I do know I can use the F4 key to reference the project DLL, but it seems I can't really exercise the service and controller functions in the manner. Besides, I think it would be cool to use LinqPad6 as a debugging platform!
Thanks for any thoughts.
Randy

Related

Could not load file or assembly (DarkRift)

I've been struggling with a problem in Unity and I would appreciate it if anyone can help me.
I'm using a package called DarkRift, which is used for networking and connecting clients with a server (provided by DarkRift). In order to work with the DarkRift server, I need to write plugins. A plugin is basically a visual studio project, compiled to .dll file, then that file is copied to a certain directory on the server-side.
I've been working with DarkRift for some time now and have done so much with it. It was working perfectly! However, I needed to work with Firestore package from Google.
Hence, I created another plugin, installed Firestore (and every package needed), wrote some simple code using one of Firestore's functions, compiled the project, copied .dll to the server, then ran the server. The problem is whenever I run the server (.exe file), I get an error that says: "Could not load file or assembly 'Google.Cloud.Firestore, Version=1.0.0.0, ...' or one of its dependencies."
I get this error when I use any of Firestore's functions. However, if I just include the package (using Google.Cloud.Firestore;) without using any of its functions, I don't get any error. I googled this problem and looked everywhere and could not solve it.
Thanks!
Firestore is distributed as a Nuget package, which indeed has dependencies.
Have you also copied all those dependencies to the server?
It might also be a framework incompatibility.
To get more details about this kind of problem, you can register a logging event handler on AppDomain.AssemblyResolve, which fires when assembly resolution fails.
You can also use tools like dnSpy to dig into the problematic assembly - it shows you all sorts of metadata and it can decompile the CIL, which is invaluable for debugging strange behavior in third party code.
Assembly loading is kind of slow in .Net, so it only loads them when needed.
Hence the resolution does not fail when no code references the assembly.

Trying to connect a ergometer to pc using a SDK but program can't find dll

I'm trying to connect the concept2 ergometer with a PM4 with a computer so I can use it's input in a game made in Unity3D.
The company of the ergometer provides a SDK that's in C++ (I don't have experience with C++).
I'm using this code to wrap the C++ code in C#.
Here I replace "RPPM3DDI.dll" with "PM3DDICP.dll" and "RPPM3Csafe.dll" with "PM3Csafe.dll".
When I run the code the program throws the following exception:
System.DllNotFoundExeption for DLL PM3DDICP.dll
I put the files of the SDK in the solution folder so that's not it I guess...
So I read (on stackoverflow) that there can be problems with the dependencies and I used DependencyWalker. I got a ton of messages of missing dependencies but it turns out that DependencyWalker is not being maintained and some changes in Windows are causing the missing dependency reports...
The goal is to get the speed that a person is rowing with and use it in Unity3d.
The questions now are:
How can I use this SDK when he can't find the dll file?
How can I locate the dependency issues among all the 'fake' missing dependencies?
I found the problem and I thought: maybe this answer is usefull for someone else too.
The problem was that I put the SDK files in the wrong folder (noob mistake I know...).
I needed to put the files in: Project folder -> bin -> Debug
I couldn't find this solution on the internet

How do I get Quick Books SDK to work with my Visual Application?

I have an old C#/asp.net project that I need to edit. It interfaces with Quick Books to create reports. The project has a reference to Interop.QBFC11 pointing to a .dll in the GAC, but I have no such .dll in my GAC. I did find Interop.QBFC11Lib.dll in the obj/Release folder. I changed the reference to point to this file, but my "using Interop.QBFC11" reference threw a "could not be found" error. I looked at the .dll in JustDecompile and saw that the referenced namespace was QBFC11Lib so I added "using QBFC11Lib" to my program. Now I have code that I need to change from "Interop.QBFC11.QBSessionManager()" to "QBFC11Lib.QBSessionManager". I also download the latest SDK from here and ran it. It says it installed to C:\Program Files (x86)\Intuit, but I can't find the .dll there. So my questions are:
Where can I get the version of Interop.QBFC11Lib.dll that the original programmer used?
If I use the Interop.QBFC11Lib.dll that I find in the obj/Release directory and rename references from Interop.QBFC11 to QBFC11Lib, will it work the same?
How do I get the latest Interop.QBFC11Lib.dll (or whatever the name of the most recent dll is)?
We've identified the following errors in compiling the code. It looks like these were once part of the SDK, but aren't now. We need help finding what new objects/methods to use:
ENOpenMode.omDontCare not included in Interop.qbposfc3.dll or Interop.QBFC11Lib.dll
ORInventoryAdjustmentQuery has no suitable replacements. (subclass of InventoryQtyAdjustmentQuery qry)
ENMatchCriterion.mcContains has no suitable replacement
ORTxnQuery has no suitable replacement (subclass of ISalesReceiptQuery qry)
Implicit type conversion not allowed (ISalesReceiptItemRet to ISalesReceiptRet)
No Definitions for Desc1, Desc2, Qty, ExtendedPrice, ItemNumber (subclass of ISalesReceiptRet itemsRet)
** UPDATE **
Contacted Intuit support. They suggested downloading files for QBFC11 and QBPOSFC3. Tried adding references to both individually and at the same time and still getting the same errors. Below is a screenshot. Any ideas on how to get this to compile?

Type or namespace name does not exist in the namespace - yet the namespaces do exist

A project that I've been working on for a long time without any problems suddenly started throwing errors such as
The type or namespace name 'xxx' does not exist in the namespace 'yyy' (are you missing an assembly reference)?
In this case, the namespaces were all core .Net libraries such as System.Data, Linq, and IO that I've been using without any problems.
I've worked through all of the issues in this question such as making sure all the projects in the workspace are using the same version of .Net for the Target Framework setting.
I removed all the libraries in question and re-added them but the problem persisted. I doubt they libraries themselves are corrupted as I reference them in other projects within the solution.
After rolling back through my work with TFS I managed to work out what I'd done that had created this error: I'd added a folder called "System" to my project and put a class file in it.
This is an easy issue to reproduce: create a project, add a folder called system to it (it will still compile at this point) and then create a .cs file in it, that's when all the fun errors will occur.
The problem stems from the name of the "System" folder which leads to any files created in it being under the namespace ".System".
I can understand why having a folder / namespace called "System" would cause problems now but I think it would help if Visual Studio warned when creating a folder / namespace of such a name to stop this problem happening in the first place. I've logged a bug with MS, at least having this logged might help any other people who have made the same mistake as me!
I had the same issue after my system shut down unexpectedly and even though VS tried to restore, the problem popped up.
I had two projects in my Solution Explorer. To solve this, I right-clicked the project that was associated with the error message and selected 'Build'.
After that, the issue was resolved.
Just to add that the problem was permanently solved after I added a reference to the 'project' from the other 'project'.
I renamed the namespace of the file I was referencing from myproject.shared.constants to myproject.SOMETHING.shared.constants
After that It suggested "use myproject.SOMETHING.shared.constants" as suggestion. I renamed it back to myproject.shared.constants and then it worked.
Try to Clean and Then Rebuild the dll file .I was experiencing the same problem tried different suggestions from internet but none of them work.But it will. In case you don't know how follow these steps:
open your dll project file.
2.click on solution Explorer Right click on Your Dll Project Name you will find Clean and Rebuild Option.

VS2010 C# missing project dll during build

I have problem with build in VS2010. I´m trying to develop small Prism, MVVM application.
I added new project "Toolbar" to my solution "MyApp" and during the build I get following error (propably project´s dll is not created for some reason):
Error 2 Could not load referenced assembly
"C:\net\projects\MyApp\MyApp.Modules.Toolbar\bin\Debug\MyApp.Modules.Toolbar.dll".
Caught a FileNotFoundException saying "Could not load file or assembly
'C:\net\projects\MyApp\MyApp.Modules.Toolbar\bin\Debug\MyApp.Modules.Toolbar.dll'
or one of its dependencies. The system cannot find the file
specified.".
C:\net\projects\MyApp\MyApp\ResGen MyApp
I´m quite new to VS2010 and C# so I really don´t know what happend, wheter project dll is missing because of some mistake in source code or why this can even happend? I also don´t know how to find such a mistake in source code, because VS shows up only the error mentioned above. Dependenies of the project should be ok i guess, file MyApp.Modules.Toolbar.dll really doesn´t exist in any folder on my hdd.
The problem was the bad class name defined in xaml of Toolbar project (UserControl x:Class="BAD CLASS HERE").
After many googles for a similar problem where I had at one time toyed with using open office in a .net project and then all my aspx pages had the blue squiggely line saying cli_uno couldn't be found which was referenced no where and in none of my project or lib files.
I deleted all the bin folders, a dll referencing it was hiding in one of them and making vs2010 freak out.
I realize this isn't the exact solution to the above but there isn't much out there for this error and it is a head scratcher and deleting all the bin folders worked for me so it's something to try.
You provide too litle information, so I'll ask some questions (and some possible fixes):
Is the file at the specified path to begin with?
If not, is there a project you need to build to create the dll?
If there is such project, does it build the .dll where yours is looking for it -- if not, you either need to copy it by hand or set up a post-build process to do the copy automatically after each build
If there is no such project, do you have the .dll itself somewhere. If yes, you need to copy it to the correct location.
If the .dll is at the correct location, is there some protection preventing the other project to access it?

Categories

Resources