Skip to content

Plugins should include ExcludeAssets=runtime for project references to shared assemblies #15811

@vitek-karas

Description

@vitek-karas

The guide along with the sample it uses has this for non-private project references:

<ProjectReference Include="PluginBase">
  <Private>false</Private>
</ProjectReference>

This works for the sample itself, but it doesn't always correctly translate for more complex projects. Specifically if PluginBase would have a PackageReference, the "Private=false" doesn't correctly propagate over to the PackageReference and the output contains "traces" of the NuGet package (in the .deps.json). This can cause issues when loading plugins.

The workaround seems to be to include "ExcludeAssets=runtime" as well, so the project reference would look like this:

<ProjectReference Include="PluginBase">
  <Private>false</Private>
  <ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>

The exact workaround needs to be validated with the product team (@nguerrera).
Even though this is not necessary for the sample in question, fixing it here will make people using the guide more likely to a working state at first try.

We're still trying to figure out if this is an actual product bug or if this is a desired behavior. Either way for .NET Core 3.0 this is how it works, and so fixing the guide is preferable.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions