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

.NET 5/6 file copy error #446

Open
rpopovych opened this issue Mar 8, 2022 · 2 comments
Open

.NET 5/6 file copy error #446

rpopovych opened this issue Mar 8, 2022 · 2 comments

Comments

@rpopovych
Copy link

When using RH library in .NET 5/6, the following error happens:

Unable to copy ./Scripts/db1/OneTime/YYYY-MM-DD-Initials-JiraTicket-1-SampleRoleCreation.sql to ./Scripts/db1/OneTime. 
System.DllNotFoundException: Unable to load shared library 'kernel32' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32: cannot open shared object file: No such file or directory
   at roundhouse.infrastructure.filesystem.DotNetFileSystemAccess.CopyFileA(String lpExistingFileName, String lpNewFileName, Int32 bFailIfExists)
   at roundhouse.infrastructure.filesystem.DotNetFileSystemAccess.file_copy_unsafe(String source_file_name, String destination_file_name, Boolean overwrite_the_existing_file)
   at roundhouse.runners.RoundhouseMigrationRunner.copy_to_change_drop_folder(String sql_file_ran, Folder migration_folder)
   at roundhouse.runners.RoundhouseMigrationRunner.traverse_files_and_run_sql(String directory, Int64 version_id, MigrationsFolder migration_folder, EnvironmentSet migrating_environment_set, String repository_version, ConnectionType connection_type)

The issue is here:

private static readonly bool is_running_dotnet_core = RuntimeInformation.FrameworkDescription.StartsWith(".NET Core");

There is handing for Mono & .NET Core, but with .NET 5 the Core naming has been dropped.

I see this deliberation here, but has anyone tried to at least support use of libraries in .NET 6? I don't believe that would require upgrading the project to .NET 6 and it might be just this one place to fix.

.NET 3.1 End of Support is at the end of 2022: https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core

@kbialkowski
Copy link

@rpopovych
Hi got same error
When trying to run under the docker container with .NET 5 I get
image

Did you manage to find solution?

@kbialkowski
Copy link

@rpopovych
The workaround I found is to install 3.1 runtime in the container.
Add this to your dockerfile

COPY --from=mcr.microsoft.com/dotnet/runtime:3.1.31-buster-slim /usr/share/dotnet/shared /usr/share/dotnet/shared

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