0

OK,I'm not a seasoned developer - I typically do my coding in the scripting realm. But in this case, I want to compile a bit of code in C#, that interfaces with Catia. It is a console app, when executed, prompts user for a selection. No UI from the Catia API, just onscreen text prompts.

That being said, the only dependencies in this code, are the dll references that live in the install code/bin directory. Every user gets the same installation, and the dlls that are required, are present. If not, the user has no reason to use my code. Additionally, building the exe with the dependencies, just unnecessarily duplicates the dlls from Catia.

So the question is, how do I go about pointing the exe to the dll folder? Or, would it be best just to deploy my exe from the same folder that contains the dlls? (assuming that I can)

I've read many many posts by people asking the same basic question, and I know that it's almost always recommended against. However, since this is application specific, I think my case might be a little different. This code has no utility, in the absence of the Catia application.

Mhan7
  • 1
  • 3
  • Maybe this [social.msdn link](https://social.msdn.microsoft.com/Forums/vstudio/en-US/4eb0026c-135b-4f4c-9ec2-0ef39a1b001a/referencing-a-dll-in-a-location-different-from-exe?forum=csharpgeneral) may help – Hayden Mar 26 '20 at 07:02
  • Why do you think you need to do this? Having references to the type libraries should be enough. – C R Johnson Mar 31 '20 at 16:06
  • "Enough" for what? The compiled code is reproducing dlls that already exist in the code/bin folder of the application. Is there a way that I can tell the compiler to use the ones that are already there? In a perfect world, this would be a single .exe file. – Mhan7 Apr 01 '20 at 18:48
  • If the type libraries are properly registered, you can select them as COM references in Visual Studio and your executable should be able to use them from where they are. This is how we work. You can run cnext.exe -regserver from the catia bin directory to insure the correct versions of the libaries are registered. Normally they are registered automatically by an install but they may be unregistered inadvertently for example if someone uninstalls an old version of CATIA. – C R Johnson Apr 02 '20 at 15:32
  • The libraries are definitely properly registered. I understand that part. But in Visual Studio, there must be a way to assign the path to the dlls. Because my code only works when it's in a container with the duplicated dlls after compiling, OR when I put the executable directly into the same folder as the dlls in the Catia install path - which, due to our deployment policy, is not what we want. (we actually have a folder one level deeper that is specifically for custom code) – Mhan7 Apr 03 '20 at 16:18

0 Answers0