- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Update host to use the optional localPath property when resolving assets #118297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements support for the optional localPath property in .deps.json files to allow more flexible asset resolution in the .NET host. The host now uses the localPath property when available to determine the actual file location relative to the application directory, providing better control over asset placement.
Key changes:
- Updated asset resolution logic to prioritize localPathwhen available
- Modified path computation to handle different asset types and library types appropriately
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description | 
|---|---|
| src/native/corehost/hostpolicy/deps_resolver.cpp | Updated asset resolution logic to use localPathand refactored method names | 
| src/native/corehost/hostpolicy/deps_format.cpp | Added parsing and tracing for the localPathproperty | 
| src/native/corehost/hostpolicy/deps_entry.h | Added local_pathfield todeps_asset_tstruct and updated method signatures | 
| src/native/corehost/hostpolicy/deps_entry.cpp | Implemented new path resolution logic using localPathwith fallback behavior | 
| src/native/corehost/fxr/standalone/hostpolicy_resolver.cpp | Fixed a bug where version string was not being returned | 
| src/installer/tests/TestUtils/NetCoreAppBuilder.cs | Added support for localPathin test infrastructure | 
| src/installer/tests/TestUtils/DotNetBuilder.cs | Updated test builders to use new WithLocalPathmethod | 
| src/installer/tests/HostActivation.Tests/SelfContainedAppLaunch.cs | Added test for custom runtime location using app-relative paths | 
| src/installer/tests/HostActivation.Tests/DependencyResolution/ResolveComponentDependencies.cs | Updated test to use new WithLocalPathmethod | 
| src/installer/tests/HostActivation.Tests/DependencyResolution/LocalPath.cs | New comprehensive test file covering all asset types with and without localPath | 
| src/installer/tests/HostActivation.Tests/DependencyResolution/DependencyResolutionCommandResultExtensions.cs | Added helper methods for testing resource root path resolution | 
Currently, when resolving RID-agnostic assets from an application itself (that is, those in the app's .deps.json), any subdirectory specified in the file path is ignored. We just take the file name and expect it to be next to the .deps.json.
#117682 added an optional
localPathproperty for assets. If set, this represents the path on disk relative to the .deps.json. This change updates the host to consume that property. When resolving assets from an application itself:localPathproperty is set: use<deps_dir>/<localPath><deps_dir>/<file_path><deps_dir>/<file_path><deps_dir>/<file_name><deps_dir>/<dir_name>/<file_name>Example .deps.json resolution
With the following package in a .deps.json:
The paths would be:
<deps_dir>/pkg/lib.dll,<deps_dir>/lib2.dll<deps_dir>/pkg<deps_dir>/pkg/runtimes/win-x64/nativeWith this change, usage of app-relative .NET search, and some msbuild hackery, it is possible to publish a self-contained application and stick the runtimepack in a subdirectory:
Resolves #3525
cc @dotnet/appmodel @AaronRobinsonMSFT