-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
Libraries which do not contribute any runtime assets may not be included in the deps.json file.
Version
.NET 10 Preview 5
Previous behavior
All referenced NuGet packages and projects would be included in the deps.json file as library entries, even if there were no assets used from them.
New behavior
NuGet packages or other libraries may be excluded from the deps.json file if:
- They don't contribute any runtime assets
- Removing the library from the deps.json would not cause any libraries which do contribute runtime assets to no longer have a dependency path to them.
Type of breaking change
- Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
- Behavioral change: Existing binaries might behave differently at run time.
Reason for change
The deps.json lists runtime dependencies and is used by the loader to load those dependencies. Some other tools also process the deps.json file. Including libraries that are not actually used is less accurate and can lead to false positives for security scanners that use the deps.json file if the file lists dependencies that are not actually used.
Recommended action
To disable the new behavior, set the TrimDepsJsonLibrariesWithoutAssets
MSBuild property to false.
Feature area
SDK
Affected APIs
No response