WaelHamze / xrm-ci-framework

xRM CI Framework provides you with the tools automate the build and deployment of your CRM Solution. Using the framework to implement a fully automated DevOps pipeline will allow you to deploy more frequently with added consistency and quality.
MIT License
186 stars 116 forks source link

Empty GUID During PluginRegistration #303

Open YTKme opened 3 years ago

YTKme commented 3 years ago

Hi Wael,

I've been using the PowerShell scripts you wrote for D365 automation along with Jenkins to do solution deployment, and mostly is been working well so far. (due to company security compliance, we are unable to use Azure DevOps).

One issue we've been unable to solve is how to automate plugin registration with PowerShell scripts. It seem like you currently have a few scripts for Plugin Automation, mainly GetPluginRegistration.ps1 for generating mapping files, and PluginRegistration.ps1 for registering plugins. I mirror some of the VSTS task script with some modification to use with Jenkins.

While testing the PluginRegistration.ps1 script in my development environment with PowerShell, I seem to be getting the following errors:

WARNING: Extracted id using plugin assembly name AlphaPlugin
VERBOSE: Trying to upsert AlphaPlugin / 00000000-0000-0000-0000-000000000000
Set-XrmPluginRegistration : Expected non-empty Guid.
At C:\Work\Tool\xRMCIFramework\PluginRegistration.ps1:40 char:1
+ Set-XrmPluginRegistration -RegistrationType $RegistrationType -Assemb ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-XrmPluginRegistration], FaultException`1
    + FullyQualifiedErrorId : System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral,  
   PublicKeyToken=31bf3856ad364e35]],Xrm.Framework.CI.PowerShell.Cmdlets.SetXrmPluginRegistration

I understand that it is missing the GUID, but I am not sure how it is specified.

On the code side, under the Properties of AssemblyInfo.cs, the GUID seem to be specified with:

[assembly: Guid("...")]

I also tried registering the plugin with and without a mapping file that I generated with GetPluginRegistration.ps1, but still getting the same error. I was wondering if I am missing something or doing something wrong?

The plugin assembly registers fine with the Plugin Registration Tool, but getting an error with the script.

UPDATE: I was able to get the plugin registered with the generated mapping file. But looking closer at the code for SetXrmPluginRegistration.cs, it seem like only the RegistrationType and AssemblyPath is required, and the other information can be generated. I tried it with just those 2 parameters, I get the same error of missing Guid.

Ramunas9 commented 5 months ago

Hello I have the same issue. Problem is that you cannot create anything in dynamics without specifying GUID. Currently code requires you to specify GUID or entity that you are create must exist in dynamics with the same name. Then ir retrieves GUID from dynamics by name. However, I need to create new e.g. Service Endpoint, but i do not have and do not whant to hardcode custom GUID, i would rather dynamics generate one for me. Is there any options to do so?