How to determine whether the NuGetPackageId of RuntimeCopyLocalItems is in _ExcludePackage in Condit
I have a
.targets
file and I want to use a Condition to check if RuntimeCopyLocalItems.NuGetPackageId is in _ExcludePackage. However, I haven't found a successful method. How should I write this?1 Reply
Actually, I’m building a plugin API (contract) library. I want plugins that reference it to be able to quickly exclude libraries that the host application already provides. Maybe there’s a better approach? I feel like I might be heading down the wrong path.
In the plugin API (contract) library, there are packages owned by the host, and they can be excluded via PrivateAssets. However, I’m running into an issue: when a plugin’s dependency transitively depends on a host-owned package, those packages get pulled back into the output directory. My project is managed using Microsoft.Extensions.Hosting. If these packages are copied back to the output directory, an AssemblyLoadContext (ALC) mismatch occurs, causing the DI container to fail to resolve types and preventing host-provided features (such as logging) from being injected.