Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.FileLoadException: Could not load file or assembly #736

Closed
m4ss1m0g opened this issue Aug 16, 2023 · 2 comments
Closed

System.IO.FileLoadException: Could not load file or assembly #736

m4ss1m0g opened this issue Aug 16, 2023 · 2 comments

Comments

@m4ss1m0g
Copy link

When I execute this code it raises FileLoadException, the issue can be reproduced also in a Docker container.

#r "nuget: NuGet.Packaging, 6.7.0"
#r "nuget: NuGet.Protocol, 6.7.0"

using System.Threading;
using NuGet.Common;
using NuGet.Protocol;
using NuGet.Protocol.Core.Types;
using NuGet.Versioning;

Console.WriteLine("Start");

ILogger logger = NullLogger.Instance;
CancellationToken cancellationToken = CancellationToken.None;

SourceCacheContext cache = new();

And the Dockerfile

FROM mcr.microsoft.com/dotnet/sdk:7.0

# https://www.nuget.org/packages/dotnet-script/
RUN dotnet tool install dotnet-script --tool-path /usr/bin

WORKDIR /app
COPY main.csx .
ENTRYPOINT [ "dotnet", "script", "main.csx" ]

For building the image docker build -t dotnet-script . for run docker run --rm dotnet-script

@seesharper
Copy link
Collaborator

Try adding --isolated-load-context when executing the script 👍

@m4ss1m0g
Copy link
Author

It works thanks.
I attach an interesting article about the --isolated-load-context flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants