Open tisis2 opened 1 year ago
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Same result with <IncludeAssets>compile</IncludeAssets>
, using .NET SDK 8.0.100-preview.1.23115.2.
https://github.com/dotnet/msbuild/issues/4371#issuecomment-1195950719 suggests setting <DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
. That does not work here as is, because Plugin uses a type defined in PluginBaseDependency and so needs some kind of reference to it. If you add a direct reference to PluginBaseDependency as well, then it's OK:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PluginBase\PluginBase.csproj">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>
<ProjectReference Include="..\PluginBaseDependency\PluginBaseDependency.csproj">
<Private>false</Private>
<ExcludeAssets>runtime</ExcludeAssets>
</ProjectReference>
<ProjectReference Include="..\PluginDependency\PluginDependency.csproj" />
</ItemGroup>
</Project>
I do feel there should be a better way to control this, though.
@nkolev92 @JonDouglas Is there a way to disable transitive package reference copy in this case? Is this a feature update needed in NuGet?
There's no knobs for controlling transitivity in any way right now.
IE, you can't specify includeassets/excludeassets for transitive packages or anything like that.
I think I've seen related issues, but I was unable to find it.
Thanks. Sounds like there's no built in way to do this today. Moving to the backlog to gather additional feedback for consideration in the future.
I encountered a similar problem, the issue is in the backlog and you can’t expect a solution? Can anyone share workarounds to solve the problem?
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:
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
dotnet --info
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