Skip to content

Conversation

@jairbubbles
Copy link

Currently it's executing two times the ILRepack which was leading to duplicated symbols.

@Alexx999
Copy link
Owner

I use the .targets file and it's OK, it probably depends on what exactly you have in that file. Could you please elaborate a bit?

@jairbubbles
Copy link
Author

jairbubbles commented Jan 24, 2022

I'll send it to you tomorrow but it's pretty close to what's in the readme. One thing to mention though is that my project is multitargetting net472;net5.0-windows but the package is only used on net472.
Anyway it seems logical to have both targets executed as there are two different targets. Please note that this test is already done on the upstream repository.

@jairbubbles
Copy link
Author

Hey @Alexx999, here is a minimalistic sample to reproduce the issue (a console application that ILRepack Newtonsoft.json):

TestILRepack.zip

When you compile it (in Release), you can see ILRepack being executed two times:

➜ dotnet build -c Release
Microsoft (R) Build Engine version 17.1.0-preview-21610-01+96a618ca5 pour .NET
Copyright (C) Microsoft Corporation. Tous droits réservés.

  Identification des projets à restaurer...
  Restauration effectuée de C:\Users\jairb\Source\Repos\TestILRepack\TestILRepack\TestILRepack.csproj (en 206 ms).
  Vous utilisez une préversion de .NET. Consultez https://aka.ms/dotnet-core-preview
  TestILRepack -> C:\Users\jairb\Source\Repos\TestILRepack\TestILRepack\bin\Release\net6.0\TestILRepack.dll
  Added assembly 'bin\Release\net6.0\\TestILRepack.dll'
  Added assembly 'bin\Release\net6.0\\Newtonsoft.json.dll'
  Merging 2 assembies to 'bin\Release\net6.0\\TestILRepack.dll'
INFO: IL Repack - Version 2.1.14
INFO: ------------- IL Repack Arguments -------------
/out:bin\Release\net6.0\\TestILRepack.dll /internalize bin\Release\net6.0\\TestILRepack.dll bin\Release\net6.0\\Newtonsoft.json.dll
-----------------------------------------------
INFO: Adding assembly for merge: bin\Release\net6.0\\TestILRepack.dll
INFO: Adding assembly for merge: bin\Release\net6.0\\Newtonsoft.json.dll
INFO: Merging Win32 resources
INFO: Processing references
INFO: Processing types
INFO: Merging <Module>
INFO: Merging <Module>
INFO: Processing exported types
INFO: Processing resources
INFO: Fixing references
INFO: Processing public types tree
INFO: Writing output assembly to disk
INFO: Patching Win32 resources
INFO: Finished in 00:00:00.8770155
  Merge succeeded in 0,882258 s
  Added assembly 'bin\Release\net6.0\TestILRepack.dll'
  Added assembly 'bin\Release\net6.0\Newtonsoft.Json.dll'
  Merging 2 assembies to 'bin\Release\net6.0\TestILRepack.dll'
INFO: IL Repack - Version 2.1.14
INFO: ------------- IL Repack Arguments -------------
/out:bin\Release\net6.0\TestILRepack.dll  bin\Release\net6.0\TestILRepack.dll bin\Release\net6.0\Newtonsoft.Json.dll
-----------------------------------------------
INFO: Adding assembly for merge: bin\Release\net6.0\TestILRepack.dll
ERROR: Failed to load assembly bin\Release\net6.0\TestILRepack.dll

@jairbubbles
Copy link
Author

Hi @Alexx999, did you have time to look into it?

@Alexx999
Copy link
Owner

Sorry I've dropped a ball here badly with all that things that are happening in my country.
Anyway, the intent was that you can set DoILRepack to 'false' (or 'true' based on your own logic) in your targets file if you want to prevent the default run from happening.

@jairbubbles
Copy link
Author

This should indeed feel so insignificant, I can't imagine what you're going through.

I can indeed workaround by setting:

  <Target Name="ILRepacker" AfterTargets="Build">
    <PropertyGroup>
      <DoILRepack>false</DoILRepack>
    </PropertyGroup>

I feel like though that it would be better to match the upstream's behavior for people migrating from the old package. Or at least update the README to indicate that?

@Sewer56
Copy link

Sewer56 commented Jul 31, 2022

This should be documented, I agree wholeheartedly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants