ravibpatel / ILRepack.Lib.MSBuild.Task

MSBuild task for ILRepack which is an open-source alternative to ILMerge.
Other
107 stars 30 forks source link

ILRepack.Config.props gets ignored. #15

Closed Garonenur closed 8 months ago

Garonenur commented 5 years ago

The documentation (which is very sparse btw) says, put the config in the project. But the file gets ignored if I build the whole solution.

uecasm commented 5 years ago

Did you try closing and reopening the solution after adding the file? Top-level property imports seem to get cached and don't update properly unless you reload the solution.

ravibpatel commented 5 years ago

@Garonenur Does the suggestion from @uecasm fixed the issue? This shouldn't happen cause it is working fine in Project itself.

replaysMike commented 3 years ago

I can't get the props configuration file to load at all.

ravibpatel commented 3 years ago

@replaysMike Are you adding it at root of project directory?

replaysMike commented 3 years ago

@ravibpatel yep. The project, not the solution root. It's weird because at first it worked when it was not loading the .targets file, when I fixed that the configuration no longer worked. Tested this using the ClearOutputDirectory option which stopped cleaning the merged assemblies.

replaysMike commented 3 years ago

if you wish to see yourself, it's used in the latest version of AnyClone - I removed the config file in the source but easy enough to add in for testing.

ravibpatel commented 3 years ago

@replaysMike It happens cause when you provide your custom targets file it assumes you want full control of the ILRepack procedure, so it doesn't do the cleaning. It only works when using the default targets file that comes with the package. You can add cleaning task in your ILRepack.targets. Just add the following after line 20 in your ILRepack.targets.

<Target
    AfterTargets="ILRepacker"
    Name="CleanReferenceCopyLocalPaths"
    Condition="$(Configuration.Contains('Release'))">
    <Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
    <ItemGroup>
      <Directories Include="$([System.IO.Directory]::GetDirectories('$(OutDir)%(DestinationSubDirectory)', '*', System.IO.SearchOption.AllDirectories))" />
      <Directories>
        <Files>$([System.IO.Directory]::GetFiles("%(Directories.Identity)", "*", System.IO.SearchOption.AllDirectories).get_Length())</Files>
      </Directories>
    </ItemGroup>
    <RemoveDir Directories="@(Directories)" Condition="%(Files)=='0'" />
</Target>