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

"The plugin cannot be loaded A newer .NET framework is required." error on Linux #343

Closed
dlech opened this issue May 9, 2022 · 4 comments

Comments

@dlech
Copy link
Owner

dlech commented May 9, 2022

.... However there is another problem using KeeAgent on mono.

image

As root create the path mkdir -p "/etc/mono/registry/LocalMachine/software/microsoft/net framework setup/ndp/v4/full/"

Inside this path create a file named "values.xml" echo -e "<values>\n<value name="Install" type="string">1</value>\n<value name="Version" type="string">4.8.04084</value>\n</values>\n" > "/etc/mono/registry/LocalMachine/software/microsoft/net framework setup/ndp/v4/full/values.xml"

Content of values.xml

<values>
<value name="Install" type="string">1</value>
<value name="Version" type="string">4.8.04084</value>
</values>

When I do the registry patch KeeAgent is running...

Originally posted by @jnko in #341 (comment)

@dlech
Copy link
Owner Author

dlech commented May 9, 2022

For technical reasons, we have had to bump the minimum .NET version to 4.6.2. For some reason, even though Mono is compatible with this version, it still reports an older version. As mentioned in the previous comment, there is a workaround. At a minimum, we need to document this, but it would be even better if we could find solution that doesn't require users to have to research the error and find the workaround.

@dlech dlech changed the title "The plugin cannot be loaded A newer .NET framework is required." on Linux "The plugin cannot be loaded A newer .NET framework is required." error on Linux May 9, 2022
@jnko
Copy link

jnko commented May 10, 2022

Thanks for clarifying.

I can confirm that for running with mono we still need to set some registry values either globally or in user context. According to
https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
the registry value of the Release key must be set to 394802 for .NET 4.6.2.

The globally method (Execute as root):

mkdir -p /etc/mono/registry/LocalMachine/software/microsoft/net\ framework\ setup/ndp/v4/full
echo -e '<values>\n<value name="Install" type="string">1</value>\n<value name="Version" type="string">4.6.2</value>\n<value name="Release" type="int">394802</value>\n</values>\n' > "/etc/mono/registry/LocalMachine/software/microsoft/net framework setup/ndp/v4/full/values.xml"
chmod -R ugo+r /etc/mono/registry

The User-Context method (Execute as User):
The "trick" is to change the environment variable MONO_REGISTRY_PATH to mono, either in your user environment or by prefixing it.

mkdir -p ~/.mono/registry/LocalMachine/software/microsoft/net\ framework\ setup/ndp/v4/full/
echo -e '<values>\n<value name="Install" type="string">1</value>\n<value name="Version" type="string">4.6.2</value>\n<value name="Release" type="int">394802</value>\n</values>\n' > ~/.mono/registry/LocalMachine/software/microsoft/net\ framework\ setup/ndp/v4/full/values.xml
MONO_REGISTRY_PATH=~/.mono/registry mono KeePass.exe database.kdbx

The values.xml-File for both methods should look like:

<values>
<value name="Install" type="string">1</value>
<value name="Version" type="string">4.6.2</value>
<value name="Release" type="int">394802</value>
</values>

A bit tricky but fortunately KeePass and KeeAgent will perfectly run with mono now.
Use KeeAgent version (or higher) mentioned at

System.DllNotFoundException: Comctl32.dll assembly:<unknown assembly> type:<unknown type> member:(null)

@jnko, this should be fixed now: https://github.com/dlech/KeeAgent/suites/6440404711/artifacts/235755018

@dlech dlech added the bug label May 10, 2022
@dlech
Copy link
Owner Author

dlech commented May 10, 2022

I have submitted a patch to KeePass to fix this so we don't have to mess with fake windows registry: https://sourceforge.net/p/keepass/patches/130/

@dlech dlech added docs needed and removed bug labels May 22, 2022
@dlech
Copy link
Owner Author

dlech commented May 22, 2022

The upstream patch was accepted (use the link above to get build of KeePass 2.x for testing). So now this will just be a matter of documenting that KeePass 2.52 is the minimum required version on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants