Creating A Package from Zero Touch Nodes

I am trying to make a package from a zero touch node project that I created.

I am following this example: Build a Package From Visual Studio · GitBook

I have moved all of my, call it “base” files, into the src folder as outlined in the link and I am trying to copy all of the created .dll and .pdb files into the “package” bin file as I understand it.

Here is an image of my folder structure:

image

I have edited the .csproj file as outlined in the link above and added an Afterbuild event to the file.

  <Target Name="AfterBuild">
    <ItemGroup>
      <Dlls Include="$(H:\RAM API STUFF\Jon v2 - Build Package RAM-API\src\bin\Debug)*.dll" />
      <Pdbs Include="$(H:\RAM API STUFF\Jon v2 - Build Package RAM-API\src\bin\Debug)*.pdb" />
      <Xmls Include="$(H:\RAM API STUFF\Jon v2 - Build Package RAM-API\src\bin\Debug)*.xml" />
      <Configs Include="$(H:\RAM API STUFF\Jon v2 - Build Package RAM-API\src\bin\Debug)*.config" />
    </ItemGroup>
    <Copy SourceFiles="@(Dlls)" DestinationFolder="H:\RAM API STUFF\Jon v2 - Build Package RAM-API\package\bin\" />
    <Copy SourceFiles="@(Pdbs)" DestinationFolder="H:\RAM API STUFF\Jon v2 - Build Package RAM-API\package\bin\" />
    <Copy SourceFiles="@(Xmls)" DestinationFolder="H:\RAM API STUFF\Jon v2 - Build Package RAM-API\package\bin\" />
    <Copy SourceFiles="@(Configs)" DestinationFolder="H:\RAM API STUFF\Jon v2 - Build Package RAM-API\package\bin\" />
  </Target>

Running the build event does not seem to copy any of the source files over to the package\bin file.

No error pop up either, I am not sure where I am going wrong this setup. Any insight would be appreciated.

I also found this post outline a different approach on creating a package for zero touch nodes.

If you have an opinion on which direction is better, please let me know.

Thanks!

Follow these steps:

2 Likes

built in targets in msbuild have changed I think if you are building against a new .net version. What are you targeting?

Thanks for the link, I am successfully able to copy all files from my bin/debug location and into my package folder now, but I am still not getting the package to load in correctly into the dynamo sandbox environment.

Here is my folder structure, the package folder contains all the files I think I need.

image

As I understand, I do not need anything in the dyf or extra folder and they are blank.

The pkg.json file has:

{
        "license": "",
        "file_hash": null,
        "name": "Reaveley - RAM API",
        "version": "1.0.0",
        "description": " Reaveley - RAM API",
        "group": "",
        "keywords": null,
        "dependencies": [],
        "contents": "",
        "engine_version": "2.17.0.3472",
        "engine": "dynamo",
        "engine_metadata": "",
        "site_url": "",
        "repository_url": "",
        "contains_binaries": true,
        "node_libraries": [
            "REA.RAM_API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
        ]
}

The bin folder has all the elements copied over to it.

With all this in place, I add the package path to the package manager, but the package does not appear in the library.

Any ideas on what is going wrong?

I am not sure what exactly this means, when editting the .csproj file, I see this in my code:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <PostBuildEvent>xcopy /Y "$(TargetDir)*.*" "H:\RAM API STUFF\v2 - RAM-API\package\bin"</PostBuildEvent>
  </PropertyGroup>

I think your package path is just a bit off.
These paths should not point to individual packages but to folders that contain packages - so I think you just need to go one level up.

some info on the different targets for doing stuff after a build:

I tried going up one level and still no dice. Thanks for all your help so far.

I want to clarify, does this package need .dyf files in the dyf folder? Currently I have no files in the dyf folder and reviewing some of the other packages, they all have .dyf files in the dyf folder.

If I do need these, how do I go about creating these files?

nope, those are only for custom node (embedded graphs)

Hmm, might be an issue with .json file then. Going to try to remaking it.

Your defining absolute paths as macros for your Includes. Get rid of the $() syntax and just include your paths within the quotes.

Also, use xcopy for after builds, it’s more suited to modern C# solution templates, like CORE 6 and more flexible than using the csproj.

Also, you can do this instead of absolute paths:

<Dlls Include="$(OutDir)*.dll" />
<Pdbs Include="$(OutDir)*.pdb" />
<Xmls Include="$(OutDir)*.xml" />

Still having trouble with this and trying to manually troubleshoot at this point.

A few samples of what I have tried, having the minimum amount of .dll’s, pdb’s, and config files, dynamo sandbox opens, but does not recognize the package “RAM_API”, see below for files in the bin folder:

Copying all files from bin folder causes sandbox to not load at all, won’t get past the splash screen:

I think I have finally nailed down the file structure as well:

image

Any ideas on how to troubleshoot? Thanks

After some trial and error, the .dll that causes dynamo sandbox to not get past the loading screen is “DynamoCoreWpf.dll”

Not including this in the bin folder allows dynamo sandbox to launch, but the package is still not recognized by dynamo sandbox.

Looks like you might be copying dlls which you ought not be.

Make sure copy local is set to false for most (all) of the Dynamo references as per the second half of the References heading in the Dynamo Unchained link above. My experiments have had that set to false for all the different references which has worked quite well. Also make sure your project uses the nuget package for your particular build of Dynamo - if you’re referencing say 1.3 and trying to use 2.17 that might explain the issue.

It may also help to review the log from a Dynamo session where your package fails to load - it may have an indication of what the issue is.

1 Like

Do you mind explaining how to check the nuget package is targeting the correct version of dynamo?

I can see that my dynamo core package has a version of 2.0.3.8810, maybe this is the issue?

image

The dynamo I am running is 2.17.0.3472

image

Also of note, I just updated my build to not copy the references as noted in the dynamo unchained link and review the logs from the dynamo session. No items of note in the logs for the package I am trying to reference.

You’re using 2.17 but using 2.0.3 per the version field. Now many things will upgrade, but they can be slower or cause warnings or errors for users, issues or build errors.