-
-
Notifications
You must be signed in to change notification settings - Fork 421
Add basic support for netcore #190
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
base: master
Are you sure you want to change the base?
Changes from all commits
19fc8ba
5b41b14
e77a470
6b0e76b
6015eac
f0893b1
59697eb
d6f1f38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +0,0 @@ | ||
| [submodule "dnlib"] | ||
| path = dnlib | ||
| url=../dnlib.git | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,11 +94,12 @@ static void RunInternal(ConfuserParameters parameters, CancellationToken token) | |
| var asmResolver = new AssemblyResolver(); | ||
| asmResolver.EnableTypeDefCache = true; | ||
| asmResolver.DefaultModuleContext = new ModuleContext(asmResolver); | ||
| asmResolver.EnableFrameworkRedirect = false; | ||
| context.Resolver = asmResolver; | ||
| context.BaseDirectory = Path.Combine(Environment.CurrentDirectory, context.Project.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar); | ||
| context.OutputDirectory = Path.Combine(context.Project.BaseDirectory, context.Project.OutputDirectory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar); | ||
| foreach (string probePath in context.Project.ProbePaths) | ||
| asmResolver.PostSearchPaths.Insert(0, Path.Combine(context.BaseDirectory, probePath)); | ||
| asmResolver.PreSearchPaths.Add(Path.Combine(context.BaseDirectory, probePath)); | ||
|
|
||
| context.CheckCancellation(); | ||
|
|
||
|
|
@@ -384,6 +385,8 @@ static void EndModule(ConfuserContext context) { | |
| if (!Path.IsPathRooted(output)) | ||
| output = Path.Combine(Environment.CurrentDirectory, output); | ||
| output = Utils.GetRelativePath(output, context.BaseDirectory); | ||
| if (Path.IsPathRooted(output)) | ||
| output = Path.GetFileName(output); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why this is added? Why is the oath completely stripped in case the path is rooted? If the path is still rooted at this point, it only means that the output path has no relative relation to the location of the project. That is perfectly valid.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mkaring |
||
| } | ||
| else { | ||
| output = context.CurrentModule.Name; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this line without any conditions will break resolving the assemblies when mixing .NET 2.0, .NET 3.5 and .NET 4 assemblies in the same project. Means if you have a .NET 3.5 assembly as the dependency of a .NET 4 assembly, the referenced assemblies will not resolve properly, because the
mscorlibversion changes. This works during runtime, because the .NET rumtime redirectsmscorlib 3.5tomscorlib 4.0. The line you added, disables this functionality for dnlib.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will test this and
reference netfx dll in netcorelater, still not sure what will happen in this case. Is there any actual issue for the case can be tested?The option is needed for netcore, otherwise something like
System.Runtime 4.2.2will be changed to 4.0.0 byFrameworkRedirect.ApplyFrameworkRedirect(), and then it will perfer the one in GAC as extra match instead of netcore.Since
FindExactMatchis still false, it can match mscorlib 4.0 if 3.5 is not found.And what will happen if resolve 3.5 for 3.5 and 4.0 for 4.0 side by side, if reference assembly don't needed to be confused, since they should be api compatable to executed.