Skip to content

When RuntimeIdentifier is specified on executable application project, compiler shouldn't copy not used native libraries to output directory #54075

@AlexeiScherbakov

Description

@AlexeiScherbakov

Describe the bug

  1. Executable application project or test project with <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>, which references libraries with native dependencies
  2. All native dependencies a copied to output dir. Even exotic like linux-musl-loongarch64

To Reproduce

Small example. Console windows x64 only app with Magick.Net. Magick.Net dependency for Windows x64 is about 23Mb. Compiler copies 230Mb (linux, osx, etc).

Project file

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>net10.0</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
		<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.13.0" />
	</ItemGroup>

</Project>

Program.cs

var type = typeof(ImageMagick.MagickImage);
Console.WriteLine("{0}", type.FullName);

Further technical details

details of dotnet --info

 Version:           10.0.102
 Commit:            4452502459
 Workload version:  10.0.100-manifests.6d969a7e
 MSBuild version:   18.0.7+445250245
  • The IDE is VS 2026

Metadata

Metadata

Assignees

Labels

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions