- Linux debian 10
- Mono 6.12
- .net framework 4.5
I runned a c# program on linux with mono.
Now I want to add a function : change a file permission to 755 on linux.
I add Mono.Unix from nuget to the project referrence and use Mono.Unix.Native.Syscall.chmod and compile and package successfully. I compile and package it on windows 7 and mono 4.8.1.
But I run it on linux (debian 10 Mono 6.12) and get error:
System.TypeInitializtionException: The type initializer for 'Mono.Unix.Native.Syscall' threw an exception-->System.DllNotFoundException:Mono.Unix assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) Mono.Unix.Native.Syscall.get_at_fdcwd()
at Mono.Unix.Native.Syscall..cctor () [0x0000a] in <7e182e4a9ebf470ba0164bbdc84457af>:0
And there was /usr/lib/mono/4.5/Mono.Posix.dll
on linux.
Based on the source code,
MonoPosixHelper
seems to be missing in your case, github.com/mono/mono/blob/… But overall you should move away from Mono now.