Skip to main content

Dynamics GP- How to use custom .Net assembly in Dexterity

Let's take a scenario that we need to develop as dexterity script using a .net assembly/DLL program inside the Dexterity script itself.

We have to create the assembly/DLL which we need to use or else use from .net framework.


  1. In Visual Studio we have to create a class library project. Provide Name as you want in your project. In my case, i have given the name as MyAssembly.
  2. Add a new class to the project. Make sure that the access modifier of that class is public.Also, define public properties you need to access from the Dexterity script.                             public class ExtraFields
    {   
       public string Description {get;set;}
       public List<Field> FieldList = new List<Field>();
    }
    public class Field
    {   
       public string Id {get;set;}
       public string Value {get;set;}
    }
  3. Compile your project.
  4. In order to use this assembly program in your Dexterity script, you have to install that to Global Assembly Cache(GAC). Refer this to know How to Install an Assembly in the GAC
  5. Then you have to refer that to the dexterity libraries.
  6. Use that in the dexterity script.                                            using MyAssembly;
    using MyAssembly.ExtraFields;
    using System.Collections.Generic;

    local ExtraFields extraFieldsObject;
    local Field fieldObject;

    extraFieldsObject  = new ExtraFields();
    fieldObject        = new Field();

    extraFieldsObject.Description    = Your Value;

    fieldObject.Id             = Your Value;
    fieldObject.Value   = Your Value;
    extraFieldsObject.FieldList.Add(fieldObject);

    //DO YOUR WORK BELOW

Compile and run the script.


Comments

Popular posts from this blog

Azure Kubernetes Service ( AKS ) (Outline)

Welcome to AKS.  You will learn, How to create an Azure account. How to create an Azure Kubernetes Cluster from the portal. How to create a Kubernetes Cluster using Azure Cloud Shell. How to enable the Kubernetes Dashboard. How to deploy Docker image to Azure Kubernetes Service ( AKS ) from the Dashboard. How to deploy Docker image to Azure Kubernetes Service ( AKS ) from YAML.  How to scale the Kubernetes Cluster Manually. Please follow the step by step. Introduction to Kubernetes Create an Azure account. Create an Azure Kubernetes Cluster from the portal. Create a Kubernetes Cluster using Azure Cloud Shell. Create an Azure Kubernetes Cluster from CLI (Windows). Enable the Kubernetes Dashboard. Deploy Docker image to Azure Kubernetes Service ( AKS ) from Dashboard . Deploy Docker image to Azure Kubernetes Service ( AKS ) from YAML . Manual Scaling Scaling Kubernetes Cluster Manually. Helps Install Docker in Windows Computer . ...

Use Post-build Script in Visual Studio for Deployment Dynamics GP.

In my project, I had a scenario to build the assembly program and after that,  I had to perform few operation related to deployment since my project is kind of a connector to connect Microsoft Dynamics GP  to an e-Commerce solution. So, I was looking for a solution. I found out that my whole process can be executed with visual studio.Since my connector has one part of.Net assembly which is built with c#, I was using Visual Studio 2015 as my development environment. Solution In my case, I had to write a PowerShell script within my solution to automate copping file to necessary places. Refer this link if you need more information about   How to write PowerShell script once I have the script in place, we need to set the property   Copy to Output Directory to Copy always to make this script copy always to the bin folder.  Then, In visual studio project in build event, I have given following command to run  PowerShell script wi...