References visible in library

Hi all,

I have another question. If I add references to my zero touch project in visual studio, the referenced library will also show up in Dynamo. This is unwanted as that particular dll also has elements called ‘Line’, etc. That then leads to problems with scripts in code blocks and will probably also lead to confusion for others who I want to let the package use.

For example I added a reference to a dll from a structural engineering software, as I want to create an interface between Dynamo and that application. But it also happens with Autodesk.DesignScript.Geometry.

Any ideas?

Again, your help is greatly appreciated!

The only fix is to change your names in your code so that there are no collisions with the OOTB nodes, or update your code blocks to call the correct class prior.

I recommend sticking clear of names which class with the most downloaded packages as well (Archilab, Clockwork, Rhythm, etc).

Which part of the code?
-My code in visual studio?
-In the code blocks?
-Or in the referenced dll’s? I cannot change the naming there…

Should I maybe add [IsVisibleInDynamoLibrary(false)] somewhere ?

Sorry - thought you had custom created these dlls. As far as I know the only option is to edit the code blocks to call on the correct function more explicitly (ie DSCore.Line.ByDirecrionDistance) to ensure that dynamo calls things in the right order.

I believe that Rhynamo causes similar issues.

DSCore only contains datetime methods in the designscript in Dynamo. Do I need to take some steps to be able to acces geometry elements?

to make any helpful comments I will need to see your source. types you return from your imported nodes will be generally be imported as well, so if your node returns a line type from this engineering software dll that will be imported. You can solve this with wrappers around those types.

hmmm - it’s odd that it’s reimporting protogeo directly… how are you importing your dll?

I made a solution from scratch this morning where I followed the steps given here: https://github.com/teocomi/dug-dynamo-unchained/tree/master/dynamo-unchained-1-learn-how-to-develop-zero-touch-nodes-in-csharp

The dll’s are copied by visual studio in the post build events.

In the solution explorer I can set my reference Embed interop type to false, which will then prevent Dynamo from showing the ‘RFEM’ library (as seen in the picture), but then I get this error in the Dynamo node:

Warning: TestNode.probeer operation failed.
Could not load file or assembly ‘Dlubal.RFEM5, Version=5.1.0.0, Culture=neutral, PublicKeyToken=f22b2f92593d105e’ or one of its dependencies. The system cannot find the file specified.

Does this clarify the problem?

do you copy your dependent dlls to the package folder as well? don’t embed them as interop types - instead copy your dependencies to the bin folder of your package.

I set Embed interop type to false
and
copy local to true

The dll is then copied to the package folder. That did the trick!

Thanks!

Hi all, I have a new question about this topic.

In Dynamo 1.3 I didn’t have any problems with loading my zero touch node library (which also had a ‘copy local reference’) into Dynamo on debugging. However with 2.0 I cannot have the two dll’s in the same packages folder, as Dynamo will not automatically load the add-on on startup (it is visible on the Manage Packages screen In Dynamo though).

I can either:

  1. Set copy local to false. The referenced dll is not copied but the assembly is loaded in Dynamo. I then get a ‘Could not load file or assembly’ error in my custom nodes

  2. Set copy local to true. I then need to manually import the library into Dynamo, but at least my package works in that case. This does make debugging a hassle. I would expect this option to work though, as a correct path is set for the reference in the library.

Does anyone know a solution for this problem?

I already tried uninstalling, deleting packages folder, rebooting and reinstalling all the files, but it didn’t work.

Thanks for the help :slight_smile:

Hi @Michael684 before looking for a workaround, what exactly is the issue you are having with dynamo 2.0 and your package ?

What errors do you see? What does your package include, etc.
sample project that reproduces the problem?

Hi Michael,

I have a zero touch node package that I am developing in Visual studio. I don’t get an error message, as the library compiles just fine :slight_smile: The trouble is (I think) in Dynamo. My package includes the compiled library and a locally copied dll from another company. The package needs to make a connection with that software (FEM calculation software) and therefore I added a reference. The RFEM dll is ‘as it is’ and I cannot change it.

Option 1: Setting copy local to true

On debugging, I copy the dll’s (both) to the packages folder using:

xcopy /Y “(TargetDir)*.*" "(AppData)\Dynamo\Dynamo Core\2.0\packages$(ProjectName)\bin”
xcopy /Y “(ProjectDir)pkg.json" "(AppData)\Dynamo\Dynamo Core\2.0\packages$(ProjectName)”

And I start Dynamo. I then get:

So the package is installed, but it isn’t visible under ‘add-ons’. I can add the library manually though, and then it will work just fine:

question%203-7-2018%20(3)

But this is inconvenient behavior of course.

Option 2: Setting copy local to false
I can also add the reference with copy local = true. In that case when Dynamo is started, the addon is visible immediately on the left, but I get this error message:

question%203-7-2018%20(4)

So the only things I changed in between these two tests:

  1. The setting for copy local
  2. I cleared the ArcadisDynamo2RFEM package folder so the contents are empty
  3. I recompile the library

Other remarks:

  1. When I add a random other dll I do not have this problem! :face_with_raised_eyebrow:
  2. I do not know if it is relevant, but as you can see in the pictures I also have an ExplicitCustomNodes package. If I add the RFEM reference in that project, I get the same problem with the package not showing up under ‘add-ons’
  3. I don’t remember having this issue with Dynamo 1.3. The project was set up in the same way

Finally, I do have a warning in Visual Studio. Might this be relevant?

Warning There was a mismatch between the processor architecture of the project being built “MSIL” and the processor architecture of the reference “Dlubal.RFEM5, Version=5.3.0.0, Culture=neutral, PublicKeyToken=f22b2f92593d105e, processorArchitecture=MSIL”, “AMD64”. This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. ArcadisDynamo2Rfem

Thanks Michael for your help!

can you share your vs solution? And what does your package.json file look like?

Certainly! I’ll send you a message with a wetransfer link.

This is what the contents of the json file look like:

{
“license”: “”,
“file_hash”: null,
“name”: “ArcadisDynamo2Rfem”,
“version”: “0.0.1”,
“description”: “Arcadis Dynamo test application”,
“group”: “”,
“keywords”: null,
“dependencies”: [],
“contents”: “”,
“engine_version”: “1.3.0.0”, //changing to 2.0.0.0 does not affect the package?
“engine”: “dynamo”,
“engine_metadata”: “”,
“site_url”: “”,
“repository_url”: “”,
“contains_binaries”: true,
“node_libraries”: [
“ArcadisDynamo2Rfem, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null”,
]
}

The problem was that the imported dll file came from another PC, so it was blocked on mine.

The solution is to unblock the dll file in the package folder by right clicking and clicking the unblock button under the ‘general’ tab.