microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.34k stars 2.21k forks source link

.NET cannot search assemblies in package runtime storage #1300

Open lenkasa opened 3 years ago

lenkasa commented 3 years ago

I have .NET core project which contains Config.json file where some plugins are specified. I do dotnet store and dotnet publish on this project and I expected that application automatically search and load plugins from runtime package storage, but it doesn´t. It works only if I add AssemblyLoadContext.Default.Resolving to my project and specify path to package runtime storage. Why assemblies (which are specified in .json file) aren´t automatically searched and loaded from storage?

Apollo9999 commented 12 months ago

There are a few possible reasons why .NET might not be able to search assemblies in package runtime storage:

The package runtime storage is corrupted. The assembly is not in the package runtime storage. The assembly is in the package runtime storage, but it is not referenced by the project. The assembly is in the package runtime storage, but it is not installed. The assembly is in the package runtime storage, but it is not compatible with the .NET version that you are using. To troubleshoot this issue, you can try the following:

Verify that the package runtime storage is not corrupted. You can do this by deleting the package runtime storage folder and then restoring the packages. Verify that the assembly is in the package runtime storage. You can do this by checking the contents of the package runtime storage folder. Verify that the assembly is referenced by the project. You can do this by checking the project file. Verify that the assembly is installed. You can do this by running the following command: dotnet list package --include-prerelease Verify that the assembly is compatible with the .NET version that you are using. You can do this by checking the assembly's metadata. If you are still having trouble, you can try searching for help online or contacting Microsoft support.

Here are some additional tips:

Make sure that you are using the latest version of the .NET SDK. Make sure that you are using the correct package runtime storage location. The default location is %LOCALAPPDATA%\Microsoft\DotNet\PackageRuntimeStorage. Make sure that you have the correct permissions to access the package runtime storage location. Try restarting Visual Studio. Try cleaning and rebuilding the solution.