Open
Description
Describe the bug
When building/publishing an app with package references, the generated .deps.json
contains the package assets with paths based on the NuGet package layout. However, the actual built/published app does not use those paths. The assets are directly in the output directory (or a culture-specific sub-directory for resource assemblies).
The fact that this works is actually relying on a bug in the host: dotnet/runtime#3525
Fixing this (and then the bug in the host) is necessary for any scenario for customizing the published layout - for example, for self-contained runtime location or shared libraries experience:
- Specify runtime files location for self-contained apps runtime#3453
- Unable to specify a subdirectory for assembly loading #10366
- Support deploying multiple exes as a single self-contained set runtime#53834
- Enable shared libraries and runtimes for a software suite runtime#71282
To Reproduce
- Add a
PackageReference
in a csproj:<ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> </ItemGroup>
- Build/publish and inspect the generated .deps.json:
"Newtonsoft.Json/13.0.3": { "runtime": { "lib/net6.0/Newtonsoft.Json.dll": { "assemblyVersion": "13.0.0.0", "fileVersion": "13.0.3.27908" } } }
- Compare to the published app layout. The dependency is at
<output_directory>/Newtonsoft.Json.dll
, not<output_directory>/lib/net6.0/Newtonsoft.Json.dll
, as the .deps.json indicates.
Exceptions (if any)
None
Further technical details
On latest .NET 10 builds
cc @dotnet/appmodel