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

ILmerge support and other assembly manipulation. #40

Closed
pabloko opened this issue Jun 28, 2017 · 4 comments · Fixed by #146
Closed

ILmerge support and other assembly manipulation. #40

pabloko opened this issue Jun 28, 2017 · 4 comments · Fixed by #146
Labels
Milestone

Comments

@pabloko
Copy link

pabloko commented Jun 28, 2017

Hello, anyone has ever tried to use ILmerge to combine a lot of resulting assemblies into a compact assembly and transform it to dll library?

Also, any assembly manipulation like code obfuscators fails always.

Its possible to process normally the assemblies then make the build task?

Regards

@3F 3F added the question label Feb 19, 2020
@3F
Copy link
Owner

3F commented Feb 19, 2020

I just looked at this public issue again after answering the latest email-question; Too close :)

Okay, Here's deal:

I personally not tested any obfuscators with our DllExport (there was just no need) but for any case we can talk only about POST-processing stage for this tool.

Means that any 3rd party tool will just destroy our related PE modifications.

Thus, the only possible way ~ [ Module -> {3rd tool} -> .NET DllExport ]
...

For obfuscators, you only need to try to disable at least attribute modifications when external libraries or even some specific.
Some obfuscators allows this and it could be very similar to my example with ILMerge above.

@pabloko
Copy link
Author

pabloko commented Mar 1, 2020

hello @3F would you mind to post a link? cant find reference on your tweet. many thanks

@3F
Copy link
Owner

3F commented Mar 1, 2020

@pabloko,

o_0 I think this is a correct full url to my tweet that was mentioned earlier:

https://twitter.com/GitHub3F/status/1230164176187936769

Or what "reference on your tweet" do you mean?

You can also read my complete log with details here:

upd:
Ah yes, for the convenience I also added sample of code while I was writing note above. Find here: https://gist.github.com/3F/b651430f601c99e9f10abf3a8482d3e3

copy-paste:

<!-- https://ko-fi.com/post/ILMerge-and-other-related-3rd-party-tool-for--NET-Y8Y71FVU4 -->

...
  <!-- For .NET DllExport 1.7 -->

  <Target Name="Merging" BeforeTargets="DllExportMod">
    <Copy SourceFiles="$(DllExportMetaLibFullPath)" 
          DestinationFolder="$(TargetDir)" 
          SkipUnchangedFiles="true" 
          OverwriteReadOnlyFiles="true" />

    <Exec Command="$(ILMergeConsolePath) Conari.dll $(TargetFileName) /out:$(TargetFileName) /ndebug"
          WorkingDirectory="$(TargetDir)"
          ContinueOnError="true" />
    
    <Delete Files="$(TargetDir)$(DllExportMetaLibName)" ContinueOnError="true" />  
  </Target>

  <ItemGroup>
    <PackageReference Include="Conari" Version="1.4.0" />
    <PackageReference Include="ilmerge" Version="3.0.29" />
  </ItemGroup>  
...

@3F 3F added this to the 1.7.1 milestone Apr 15, 2020
@3F 3F closed this as completed in #146 Apr 28, 2020
3F added a commit that referenced this issue Apr 28, 2020
* Adds Pre-Processing feature. Related issue #40

* Completes option for integration with Conari and others in Pre-Processing

Part of #146

* Based on `CopyLocalLockFileAssemblies`
* A bit refactored Project class. Pre-Proc feature has been splitted into separate PreProcGear implementation (IProjectGear)

* Updated form layout and its disposing method
@3F
Copy link
Owner

3F commented Apr 28, 2020

ILMerge is officially supported in our tool, starting with planned 1.7.1:

Pre-Processing

Full Details: https://ko-fi.com/Blog/Post/ILMerge---Conari---Debug-information---DllExport-=-O5O61MV8A

3F added a commit that referenced this issue May 7, 2020
* NEW: Pre-Processing feature. PR #146.
       Related issue #40

       Official ILMerge support;
       https://github.com/dotnet/ILMerge

       Quick integration with Conari for most easy access to unmanaged features;
       https://github.com/3F/Conari

       +Other related tools and assembly manipulations.
       Manual configuring: #40 (comment)

* NEW: Post-Processing. PR #148.
       Continues direction of Pre-Processing feature. PR #146
       Related issue #144

       Explanation and details:
       https://ko-fi.com/Blog/Post/ILMerge---Conari---Debug-information---DllExport-=-O5O61MV8A

       1.7.1 Provides only basic GUI support for predefined options. Thus,

        *! Some Post-Proc features are not yet available in GUI.
        But you can already configure it with msbuild:
        ```
        <Target Name="DllExportPostProc">

            <!-- After activation, you can access the following properties and items:

            $(DllExport)     - version
            $(DllExportSln)  - full path to .sln which controls current project
            $(DllExportPrj)  - full path to current project where processed .NET DllExport

            @(DllExportDirX64)    - $(TargetDir)x64\*.*
            @(DllExportDirX86)    - $(TargetDir)x86\*.*
            @(DllExportDirBefore) - $(TargetDir)Before\*.*
            @(DllExportDirAfter)  - $(TargetDir)After\*.*

            @(DllExportDependents + populated property name)
               - each populated properties from DllExportProcEnv,
                  e.g. DllExportDependentsTargetDir

            @(DllExportDependencies + populated property name)
              - each populated properties from DllExportProcEnv,
                  e.g. DllExportDependenciesTargetDir

            @(DllExportSeqDependents + populated property name)
               - each populated properties from DllExportProcEnv,
                  e.g. DllExportSeqDependentsTargetDir

            -->

        </Target>
        ```
        #148 (comment)

* NEW: Optional copying of intermediate files + x86+x64 directories into output
           for projects that dependent on projects where used DllExport. Issue #144.

           Including sequential referencing through other projects:
           #148 (comment)

* FIXED: Fixed #140 ... failed to create safe SSL/TLS context.

* FIXED: Pack of fixes for .net.dllexport.targets. PR #147.

        * Fixed "Cannot modify an evaluated object originating in an imported file".
        * Fixed possible duplication in .net.dllexport.targets when configuring.
        * Adds removing TargetsFile if not used.
        * Fixed possible loss of settings in .targets when configuring.

* FIXED: Fixed #143 'Microsoft.NET.Sdk' specified could not be found.

* FIXED: A multiple empty `<PropertyGroup />` in project files during new configuration.

* CHANGED: Wizard. Dropped support for ssl3 + tls1.0 + tls1.1

* CHANGED: Wizard. Simplified notification for stable versions.

* CHANGED: Manager. Access to hMSBuild tool (packed) via `-hMSBuild` key.
                    https://github.com/3F/hMSBuild
                    Since it uses packed version (while GetNuTool is integrated inside),
                    you need use -dxp-version to control specific version.

* CHANGED: Updated Cecil 0.11.2
           https://github.com/jbevain/cecil/releases/tag/0.11.2

* CHANGED: Updated MvsSln 2.5.2
           https://github.com/3F/MvsSln/releases/tag/2.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants