Fail to load library

Using C# to write a custom node that overwrites or creates a custom property. The code works fine as windows application. But got “Failed to load library” error while adding the dll into Dynamo. I’ve found the the first line that cause the error is at “Property invProperty = custompropertyset.Add(value, name)”. Is there any steps that I missing in order to make this work? Thanks.

public static void WriteCustomProp(string name, string value)
        {
            Inventor.PropertySet custompropertyset = Doc.PropertySets[4];
            try
            {
                Inventor.Property property = custompropertyset[name];
                property.Value = value;
            }
            catch
            {
                Property invProperty = custompropertyset.Add(value, name); //This is the problem start
            }
        }