Skip to content

Creating a plugin project will copy dependencies of your plugin base to the plugins output #31636

@tisis2

Description

@tisis2

Describe the bug

i created a plugin like is described in https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support
this will still cause dependencies of your PluginBase to be copied to the output of your Plugin project. in the Plugin project <Private>false</Private> is added to avoid the dll of PluginBase being copied but its dependencies will still be copied.

i created a small sample to illustrate that issue: PluginSample.zip
here is the tree that gets built:

SolutionDirectory
|   PluginSample.sln
|
+---Plugin
|   |   ...
|   +---bin
|   |   \---Debug
|   |       \---net6.0
|   |               Plugin.deps.json
|   |               Plugin.dll
|   |               Plugin.pdb
|   |               PluginBaseDependency.dll <-------- Should not be here
|   |               PluginBaseDependency.pdb <-------- Should not be here
|   |               PluginDependency.dll
|   |               PluginDependency.pdb
|   \---obj
|       ...
|
+---PluginBase
|   |   ...
|   +---bin
|   |   \---Debug
|   |       \---net6.0
|   |               PluginBase.deps.json
|   |               PluginBase.dll
|   |               PluginBase.pdb
|   |               PluginBaseDependency.dll
|   |               PluginBaseDependency.pdb
|   \---obj
|       ...
|
+---PluginBaseDependency
|   |   ...
|   +---bin
|   |   \---Debug
|   |       \---net6.0
|   |               PluginBaseDependency.deps.json
|   |               PluginBaseDependency.dll
|   |               PluginBaseDependency.pdb
|   \---obj
|       ...
|
+---PluginDependency
|   |   ...
|   +---bin
|   |   \---Debug
|   |       \---net6.0
|   |               PluginDependency.deps.json
|   |               PluginDependency.dll
|   |               PluginDependency.pdb
|   \---obj
|       ...
|
\---PluginSampleApp
    |   ...
    +---bin
    |   \---Debug
    |       \---net6.0
    |           |   PluginBase.dll
    |           |   PluginBase.pdb
    |           |   PluginBaseDependency.dll
    |           |   PluginBaseDependency.pdb
    |           |   PluginSampleApp.deps.json
    |           |   PluginSampleApp.dll
    |           |   PluginSampleApp.exe
    |           |   PluginSampleApp.pdb
    |           |   PluginSampleApp.runtimeconfig.json
    |           \---plugins
    \---obj
        ...

since the dependencies of the PluginBase is already part of your application, they should not be copied to the output of your plugin. they should be used from your application like it is with the PluginBase itself

To Reproduce

Further technical details

  • Include the output of dotnet --info
dotnet --info
.NET SDK:
 Version:   7.0.202
 Commit:    6c74320bc3

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.202\

Host:
  Version:      7.0.4
  Architecture: x64
  Commit:       0a396acafe

.NET SDKs installed:
  6.0.401 [C:\Program Files\dotnet\sdk]
  6.0.402 [C:\Program Files\dotnet\sdk]
  6.0.407 [C:\Program Files\dotnet\sdk]
  7.0.100 [C:\Program Files\dotnet\sdk]
  7.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
    • VS2022(17.5.3) and Rider but it should not matter actually

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions