You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried loading Microsoft.CodeAnalysis.dll via AssemblyLoadContext.Default.LoadFromAssemblyPath within a dotnet core application. This fails with an System.IO.FileLoadException: 'Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.' exception.
Is this supported or somehow possible?
The text was updated successfully, but these errors were encountered:
Regarding you actual problem, loading third-party NuGet dependencies in MSBuild tasks: It seems you bumped into same problem as I did, and originally was discussed in msbuild/1756. Currently, there is no proper solution provided by framework when your MSBuild task references third-party nuget packages.
However, while the framework solution is incoming (if it is incoming), feel free to use UtilPack.NuGet.MSBuild library. It does not require you to redistribute the (closure of) dependencies of your task assembly with your NuGet package, and it does not even require you to place your assemblies in build folder (lib folder is enough, but build works too). It works by providing a task factory, which will then take care of dynamically loading the third-party nuget dependencies for your task.
Hope this helps you in your problem, feel free to tell me if it doesn't!
I tried loading
Microsoft.CodeAnalysis.dll
viaAssemblyLoadContext.Default.LoadFromAssemblyPath
within a dotnet core application. This fails with anSystem.IO.FileLoadException: 'Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'
exception.Is this supported or somehow possible?
The text was updated successfully, but these errors were encountered: