I'm trying to resolve an issue with a 'FileNotFound' after migrating from .net core 3.1 to .net 6. This is about the nuget package dependencies, not any of the base code.
I followed the example from MS - https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support
And that example works until I add a nuget package and try to use it. Then I get 'FileNotFound' on several packages that are dependencies to the parent package.
I've tried many different settings to the projects that are also mentioned in other MS Learn items and I'm still getting the 'FileNotFound'
Following the MS Learn linked above I make the following changes:
I add the "Microsoft.Identity.Web.DownstreamApi" package to the HelloPlugin and added these two lines of code to the HelloCommand.cs along with a using:
Using Microsoft.Extensions.Logging;
var tokenAcquirerFactory = TokenAcquirerFactory.GetDefaultInstance();
tokenAcquirerFactory.SErvices.AddLogging(
(loggingBuilder) => loggingBuilder.SetMinimumLevel(LogLevel.Warning)
.AddConsole()
);
My personal project has the same problem and I can copy the files that it complains about missing into the plugin project's folder, but this sample doesn't work.
I created the plugin as a single console app and everything worked as expected.
I've checked many search engine results and tried many of their solutions including:
- adding CopyLocalLockFileAssemblies to the *.csproj plugin file as well as the main console application calling the plugin dll.
- adding EnableDynamicLoading
- writing a resolver, but can't get that to load the nuget package dependencies
- this includes the AssemblyDependencyResolver from the sample above that includes the AssemblyLoadContext.
All my code works fine in .net core 3.1 without any of these settings turned on using MEF with [ImportMany] and matching [Export(typeof(InterfaceName))]
I can provide code snippets, but this failure is happening from the Microsoft Learn example I linked above with the few changes pointed out explicitly.
Please help as I'd like to upgrade my project to .net 6 instead of writing new plugins in .net core 3.1 that is no longer supported.
Thank you in advance.