Referencing dll files - my AutoCAD plugin only works on my computer - c#

I have created an AutoCAD plugin, but encounter problems when using the plugin on certain machines. It works fine on my machine.
One thing that I have noticed is that if I change the output path of the build to a different directory I get problems stating that certain namespaces cannot be found.
The following shows the build output folder with the dll files in, the build is successful.
http://imgur.com/5va3ePj
However, if i build to an empty folder (even with dll files referenced) i get the following errors and warnings...
http://imgur.com/eM86l0u
This plugin needs to be able to be used by other users, i think im not referencing dll files properly or something as the program only runs successfully on my computer (and all computers that i have opened the solution in visual studio and built to the export folder). Copying all the files shown in the folder above to the same path on another users computer doesn't work, other users get an error stating 'Could not load fil or assembly "c:/info3d/info3dreloaded.dll" or one of its dependencies. Operation not supported. Exception from HRESULT: 0x80131515)'
Thanks in advance for any help!
Chris

For AutoCAD DLLs set the Copy Local to false. AutoCAD provides those via its runtime.
"Once a AutoCAD .NET API DLL is referenced, you must set the Copy Local property of the referenced DLL to False." from http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUID-8657D153-0120-4881-A3C8-E00ED139E0D3-htm.html

Right click on the reference and click on properties and set the "copy local" property to true

Related

System.IO.FileNotFoundException with DocumentFormat.OpenXml v 2.16.0

Context of solution: Currently, I have an external application called kdsRibbon which creates and facilitates a ribbon in Revit called "KDS TOOLS". Within this ribbon, there are multiple panels and buttons. I use the .InvokeMember property to link each button with an external command that is in a separate solution. By using InvokeMember, the ribbon looks into a specified file location to find the .dll of the external command and runs the Execute class of the external command. This also allows for rapid iteration of the external commands without restarting Revit each time.
One of the external commands I have linked to my Ribbon is called ExportXLTM (button name is Export/Import Excel), where I want to export specified data into an excel sheet with a .xltm extension. The only issue is, to do this, I need to use the reference DocumentFormat.OpenXml for properties to allow exportation to excel. I install DocumentFormat.OpenXML through Nuget, and I am able to build my solution successfully, but whenever I debug I receive this error:
"System.IO.FileNotFoundException: 'Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.16.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17' or one of its dependencies. The system cannot find the file specified.'"
So, to my understanding the flow is kdsRibbon --> Invoke External Command --> External Command runs --> Relies on DocumentFormat.OpenXml --> Error
I have looked up this error countless times and tried many things. I have changed copy local property to true, I have ensured that DocumentFormat.OpenXML and WindowsBase are both available to the solution, I have tried having both .dll files in Reference Assemblies folder, having them in the same folder location as the kdsRibbon.dll and the ExportXLTM.dll (these are in the same location folder), and I have put both .dll files in the bin of the ExportXLTM solution, and all of these return the same error. I ensured that System.IO is correctly referenced in both my Ribbon and External Command and I still receive the same error.
Is there something I am missing or can anyone help me towards a solution? Does it have to do with the Invoke Member property that causes visual studios to look in the wrong directory location for the .dll files? I have exhausted my possible solutions and I am stuck.
UPDATE: Since I am new I am not allowed to embed images so I have attached links
kdsRibbon with panels and buttons
Error Message in Debug mode within ExportXLTM external command
InvokeMember usage within kdsRibbon External Application, references external command, and also where error occurs within kdsRibbon (highlighted area)
You likely have another addin installed that uses a different version of DocumentFormat.OpenXml.

C# Application couldn't find dlls locally

I have a 32 bit application that uses a DLL built by someone else, lets call it xyz.dll. This DLL has dependencies on few other old DLLs. All dlls are saved in the same folder where my app is located. My app compiles fine but in run time, it throws an error "Could not load file or assembly "xyz.dll" or one of its dependencies. is not a valid Win32 application"
I have 2 workarounds that seems to solve this problem. In first one I moved the DLLs to a separated folder and created a batch file to run the app. The batch file first add the dlls' path to the environment, then call the app. Interestingly if I leave the dlls in the same folder with the app and just add this to the path, it wouldn't work.
The second way also moved dlls to a folder and add this path to user environment variable and run the exe directly. Either one of these solutions requires extra steps which is not ideal for app deployment. I am wondering if there is a better way?
When your dll is in the same folder as the application, it is that dll that the application attempts to load, and this fails, as you said.
When you move the dll to another folder and add the pathname of that folder to the PATH environment variable, the application works. In this case, the application is not attempting to load the dll that you have moved to another folder. If this were the case, it would fail. It must be loading another version of the dll that is in one of the folder paths that are in your PATH environment variable.
Simply use Windows search to find all copies of your dll file on your computer. You will be able to determine where that other dll is.

Could load a file or assembly "Renci.SshNet.dll"

Issue :
System.IO.FileNotFoundException: Could not load file or assembly
'Renci.SshNet, Version=2014.4.6.0, Culture=neutral,
PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The
system cannot find the file specified.
The Project is built on .Net Framework 4 which helps to transfer the files from local onto S FTP Server.
The Code works fine on my local machine without any issue,When deployed on the PROD server and run as per scheduled giving the error as mentioned above.
Let me know what exactly causing this issue.
If not installing from the gallery make sure the DLL is not marked as blocked. Windows will mark the zip and every file in it for security reasons and you will have to unblock them
Are you developing windows or web application? If web application, try enabling an option in IIS application pool -> Advanced Settings, "Enable 32 bit application" to true. This might solve your problem.
In case of windows or console application, select the reference Renci.SshNet dll and go to its properties and set "Specific version" to false.
After recently upgrading my .NET connector it gave the same error. I compile and run my app in VS and it works fine guessing because it copies all the MySQL NET assemblies to the exe folder so what I did is copied Renci.SshNet.dll to the directory of my exe and it worked. For some reason adding the path to the path system variable didn't help. Final solution was to remove the NET Connector and use mysqld in batch to do the selects and updates for the app.
Looks like you're missing the Renci.SshNet.dll.
In your project references you can edit the properties of Renci.SshNet. Make sure "Copy Local" ist set to true. It will copy the dll on build to your output directory (should be bin/Release).

Open Minidump : No native symbols in symbol file

In a C# project, I create minidump at UnhandledException.
In my Dev machine, project source and bin are under path K:\projects\*MYPROJECT*, if I manage to let it crash in my Dev machine, everything work perfectly, I can open the minidump file and correctly see source code, callstack, threads etc.
End-user program path will obviously be different; as an example, in our Test machine project is installed under C:\*MYPROJECT*. It's deployed with pdb symbol files. Anyway, when I try to open the minidump, generated on that machine, on my Dev computer (where I have the source files), Visual Studio try to find the executable and pdb file under "Test Path" (C:\*MYPROJECT*) without of course find it.
I tried setting Symbol path to include K:\projects*MYPROJECT* without any result, so I recreated the same Test directory structure, creating C:\*MYPROJECT* and copying .exe and .pdb files under that directory. Now, Visual Studio is be able to find them, but it's saying "No native symbols in symbol file", and it doesn't let me see any source code.
How can I accomplish to load the correct Symbols?
To change the directory, Microsoft describes to open the immediate window and type .exepath [path] to change it.
You can also use .srcpath [path] and .sympath [path].
Finally came across a solution.
After weeks trying to figure out what I were missing, I've found that on my development machine I have a different Framework version (in details, I have v4.0.30319.18444 vs v4.0.30319.17929 on test machine). I still don't understand why I shouldn't be able to debug my application without having the exact Framework version, but the solution was to copy mscordacwks.dll and mscordbi.dll (both of them found in C:\Windows\Microsoft.NET\Framework) from the Test machine to the folder where the minidump is.
Reference:
Managed Minidump Debugging in SP1

Clickonce deploy external dll reference not found

I'm trying to deploy an application written in wpf c#. I use an external library (irrklang). I added a reference in visual studio to that dll (it is placed in the same folder as the executable). It shows up in my application files, I deploy, install on a different machine and I get the file not found exception. I looked up the exe folder and the DLL is in the folder.
What am I doing wrong, the reference seems to be correct but the program isn't finding the dll at all
UPDATE: added solution below. Still same error:(
Check the following points:
Properties of the DLL -> Use local copy = true
Project Properties -> ClickOnce Properties -> ApplicationFiles -> Check if your dll is enlisted and manually set "Include" on it.
Then try again. ClickOnce often has annoying bugs.
Found it, the external dll requires the visual studio redistributable.

Categories