Skip to content

Warn when ProjectReference conditions may lead to missing assets (DllNotFoundException: The specified module could not be found.) #12584

Open
@donnie-msft

Description

@donnie-msft

NuGet Product(s) Affected

Visual Studio Package Management UI

Current Behavior

It's a known problem that packages.config does not support transitivity for runtime assembly references. There is nothing in VS to point out that such a ProjectReference is in effect.

Desired Behavior

Consider a UX that can highlight this scenario to customers before they get into trouble.
Some ideas:

  1. a warning stating that a project reference uses PR, while your consuming project uses PC, and this can lead to unexpected behavior.
  2. Point to a new docs page with an example of a package where this would occur, and how to workaround it via dotnet publish, or similar. Also, can link to the PackageReference migrator instructions in case that's an option for the customer.

Additional Context

An example package and exception is below. These .SNI assemblies are runtime dependencies, so t
The SNI has a targets file that is manually copying them to the output directory.

System.DllNotFoundException: 'Unable to load DLL 'Microsoft.Data.SqlClient.SNI.x64.dll': The specified module could not be
found. (Exception from HRESULT: 0x8007007E)'

Example ticket: https://developercommunity.visualstudio.com/t/DLL-not-found-for-NuGet-package/10338932

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions