-
Notifications
You must be signed in to change notification settings - Fork 88
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
When to support .net5 #66
Comments
For anyone who cares, I've been able to get neo-ConfuserEx to work with a .net5 project by applying the following changes:
(See git diff below) (2) is only necessary because the resolver failed to find:
It seems that these are located in the assembly I also needed to put a probepath where I have the dotnet SDK references installed (in the .crproj file):
Here is the diff of changes I made for this workaround (don't forget to do your own probePath stuff) diff --git a/Confuser.Core/ConfuserEngine.cs b/Confuser.Core/ConfuserEngine.csindex fcf6309..a26cec1 100644
--- a/Confuser.Core/ConfuserEngine.cs
+++ b/Confuser.Core/ConfuserEngine.cs
@@ -88,6 +88,7 @@ public static class ConfuserEngine {
var asmResolver = new AssemblyResolver();
asmResolver.EnableTypeDefCache = true;
asmResolver.DefaultModuleContext = new ModuleContext(asmResolver);
+ asmResolver.EnableFrameworkRedirect = false;
context.Resolver = asmResolver;
context.BaseDirectory = Path.Combine(Environment.CurrentDirectory, parameters.Project.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar) + "." + Path.DirectorySeparatorChar);
context.OutputDirectory = Path.Combine(parameters.Project.BaseDirectory, parameters.Project.OutputDirectory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar);
diff --git a/Confuser.Protections/ReferenceProxy/MildMode.cs b/Confuser.Protections/ReferenceProxy/MildMode.cs
index fcc50f4..e272c35 100644
--- a/Confuser.Protections/ReferenceProxy/MildMode.cs
+++ b/Confuser.Protections/ReferenceProxy/MildMode.cs
@@ -17,8 +17,16 @@ internal class MildMode : RPMode {
if (target.DeclaringType.ResolveTypeDefThrow().IsValueType)
return;
// Skipping visibility is not supported in mild mode.
- if (!target.ResolveThrow().IsPublic && !target.ResolveThrow().IsAssembly)
+ try
+ {
+ if (!target.ResolveThrow().IsPublic && !target.ResolveThrow().IsAssembly)
+ return;
+ }
+ catch
+ {
+ Console.WriteLine($"ReferenceProxy.MildMode.ProcessCall exception resolving: {target.FullName}");
return;
+ }
Tuple<Code, TypeDef, IMethod> key = Tuple.Create(invoke.OpCode.Code, ctx.Method.DeclaringType, target);
MethodDef proxy; |
These changes would work on .net6? |
@RobsonRojas I've used the obfuscator on .net6 and .net7 assemblies as well. You just have to be willing to go into dnlib and tear out all the hardcoded bullshit, then, in whatever way you please, ensure that it can find the "correct" assemblies. You don't have to point it at the ref assemblies either, I've discovered. A rather straightforward way to have all the correct assemblies in one place is to put a runtime-identifier in your .csproj file (e.g. In general, there are some other issues that you might run into using this thing, but I can't give away anymore right now. |
Seems like it would be fairly straightforward to make this officially support .NET 5/8 etc. Any likelihood of this happening soon so we don't all have to hack the code? |
Is your feature request related to a problem? Please describe.
Nothing to do with the problem.
Describe the solution you'd like
I hope to provide support for .net5, I need to confuse the function very urgently.
Describe alternatives you've considered
.NET Reactor Not in the expected results.
Additional context
nothing.
The text was updated successfully, but these errors were encountered: