WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
115 stars 54 forks source link

Empty GUID During PluginRegistration #238

Closed YTKme closed 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.

YTKme commented 3 years ago

Moved Issue