cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
srasmussen
Helper I
Helper I

Dependent Assembly - PluginPackage can not contain Microsoft.CrmSdk.CoreAssemblies

I'm trying to test out the new "Dependent Assemblies" feature here and am running into an issue. I'm sure it's because I'm not doing something correctly.  I created a new plugin project using the `pac plugin init` command line per the directions. I've installed the "Power Platform Tools" extension in Visual Studio and connected to my organization.  However, when I try to create a new "Plug-in Package" in the "Power Platform Tools Explorer" for my organization, I get the following error: 

 

TITLE: Failed to import Plug-in Package
------------------------------

PluginPackage can not contain Microsoft.CrmSdk.CoreAssemblies. Assembly found Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 in the package (mscorlib)

------------------------------
BUTTONS:

OK
------------------------------

 

This message makes sense because I'm sure internally that Dynamics will use whatever version the platform is supposed to and so your package should not include these as dependencies, however, I don't see any way to exclude them.  Obviously I need this NuGet package installed in the project so that I can develop the plugins, but upon "Deploying" the package, I imagine there must be some process that is supposed to run to remove this from the generated .nupkg file so that when I go to upload it it no longer has it as a dependency or something. Anyway, any help here would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
eleung83
Resolver II
Resolver II

1. Are you building the nupkg file (Nuget package) via building the solution in Visual Studio? If so, have a look at the contents of the nupkg file. I'm guessing it contains the Microsoft.XRM.... dlls

2. Check the csproj file that generates the nupkg. I spun up a new project using the pac cli commands and it should contain the following:

eleung83_0-1659529540669.png

If that "PrivateAssets" flag isn't there then it adds all the assemblies within that package to the publish folder which then includes all the assemblies into the nupkg

View solution in original post

7 REPLIES 7
PeterPeter
Regular Visitor

I'm having the same issue. Any ideas? 🙂

eleung83
Resolver II
Resolver II

1. Are you building the nupkg file (Nuget package) via building the solution in Visual Studio? If so, have a look at the contents of the nupkg file. I'm guessing it contains the Microsoft.XRM.... dlls

2. Check the csproj file that generates the nupkg. I spun up a new project using the pac cli commands and it should contain the following:

eleung83_0-1659529540669.png

If that "PrivateAssets" flag isn't there then it adds all the assemblies within that package to the publish folder which then includes all the assemblies into the nupkg

PeterPeter
Regular Visitor

Adding PrivateAssets flag into CoreAssemblies reference solve the problem in my case. I'm just wondering why this flag is not there by default (I've created the project with Power Platform CLI)? I suppose it should be fix in the next version of CLI tools. 

Anyway, big thanks for your help!

That did it!  Thanks!

Not sure, it could be due to the PAC CLI version you are running?

It also seems like the pac command comes installed with 2 different csproj templates for plugin projects (stored in 2 different folders "plugin" and "pluginwithnuget".

 

I fudged around with the 2 csproj templates to see which one was used when I generated a new plugin project, and it used the one in the "pluginwithnuget" folder which has the "PrivateAssets=All" set on every PackageReference.

 

The other csproj template only has one packagereference set with the PrivateAssets flag

eleung83_0-1659534203674.png

But not sure how this other csproj could be used as the template for the pac command. Could just be a legacy thing with the pac cli commands

In my case I had just installed the most recent version of the PAC CLI (v1.16.6) and the most recent version of the Power Platform Tools extension (v1.0.0.2).  Anyway, I imagine they'll get this fixed at some point but I'm glad there's a simple workaround. Thanks again!

filcole
Advocate II
Advocate II

Just noticed the latest version of pac 1.17.4 contains generates an updated PluginBase.cs that includes PrivateAssets=All.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,465)