Update host to use the optional localPath property when resolving assets#118297
Merged
elinor-fung merged 11 commits intodotnet:mainfrom Aug 13, 2025
Merged
Update host to use the optional localPath property when resolving assets#118297elinor-fung merged 11 commits intodotnet:mainfrom
elinor-fung merged 11 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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 localPath and refactored method names |
| src/native/corehost/hostpolicy/deps_format.cpp | Added parsing and tracing for the localPath property |
| src/native/corehost/hostpolicy/deps_entry.h | Added local_path field to deps_asset_t struct and updated method signatures |
| src/native/corehost/hostpolicy/deps_entry.cpp | Implemented new path resolution logic using localPath with 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 localPath in test infrastructure |
| src/installer/tests/TestUtils/DotNetBuilder.cs | Updated test builders to use new WithLocalPath method |
| 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 WithLocalPath method |
| 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 |
elinor-fung
commented
Aug 1, 2025
elinor-fung
commented
Aug 1, 2025
This was referenced Aug 12, 2025
Open
AaronRobinsonMSFT
approved these changes
Aug 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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