yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.56k stars 1.61k forks source link

Run CLI from Mac OSX #131

Closed yenyen closed 9 years ago

yenyen commented 9 years ago

Hi,

I'm trying to use Confuser.CLI.exe (latest release) from Mac OSX with Mono 3.10. I have allways this error :

mono ~/ConfuserEx_bin/Confuser.CLI.exe MyProject.crproj 

Unhandled Exception:
System.EntryPointNotFoundException: SwitchToThread
  at (wrapper managed-to-native) System.Threading.Platform:SwitchToThread ()
  at System.Threading.Platform.Yield () [0x00000] in <filename unknown>:0 
  at System.Threading.ManualResetEventSlim.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.InternalWait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <filename unknown>:0 
  at Confuser.CLI.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: SwitchToThread
  at (wrapper managed-to-native) System.Threading.Platform:SwitchToThread ()
  at System.Threading.Platform.Yield () [0x00000] in <filename unknown>:0 
  at System.Threading.ManualResetEventSlim.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.InternalWait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <filename unknown>:0 
  at Confuser.CLI.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

I tried with the same crproj file from Windows without any problem. Here the crproj file :

<project outputDir="Confused" baseDir="Release" xmlns="http://confuser.codeplex.com">
  <module path="DocumentONE.exe">
    <rule pattern="true" preset="normal" />
  </module>
</project>

Thank you, Aurélien Thévoz

yck1509 commented 9 years ago

It is caused by the library ConfuserEx used to do multithreading (System.Threading.dll) being only supported on Windows.

reapazor commented 9 years ago

+1 On making it work on Mono on Mac :)

jbeshir commented 9 years ago

I needed to do this, and after some poking around found that a NET45 build of ConfuserEx (generated by running "Build.cmd NET45") would run comfortably on OS X, since it uses the standard library for System.Threading functionality rather than a bundled assembly, and Mono's standard library includes it.

I needed to add <probePath>/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/</probePath> to the project file for it to work, but once I'd done that and integrated running it into the build process it worked smoothly.

yenyen commented 9 years ago

@jbeshir : Thank you for your answer. I tried your command but it didn't work. Instead, I forked the repository and change the targets of all .Net 3.5 projects (and remove dependency to System.Threading). Now everything run fine on OSX. Here is the link to my fork : yenyen/ConfuserEx