-
Notifications
You must be signed in to change notification settings - Fork 31
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
CleanReferenceCopyLocalPaths Not Happening v2.0.18.1 #25
Comments
If you provide your one ILRepack.targets file then it won't execute the CleanUp job as you can see from here. If you want to clean up the directory afterward then you can copy that task in your targets file or use the default targets file provided with the project. |
Here is my modified ILRepack.targets file. It still doesn't appear to execute the cleanup, even though I've removed the condition from the Target. Any thoughts? Also when I remove my .targets file, and the .props files from the project, and try to use the default targets file, it misses all of the satellite assemblies which is why I'm having to use the custom targets file. Also the default targets file, doesn't delete the source satellite assemblies eitehr.
|
You specified "ILRepack" as AfterTargets. Try using the following. <?xml version="1.0" encoding="utf-8" ?>
<!-- ILRepack -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="AfterBuild">
<ItemGroup>
<InputAssemblies Include="$(OutputPath)$(AssemblyName).dll" />
<InputAssemblies Include="$(OutputPath)de\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)es\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)en\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)fr\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)it\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)ja\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)ko\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)pt-pt\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)zh-cn\$(AssemblyName).resources.dll" />
<InputAssemblies Include="$(OutputPath)zh-tw\$(AssemblyName).resources.dll" />
</ItemGroup>
<ILRepack Parallel="true" Verbose="true" LogFile="c:\temp\output.txt" InputAssemblies="@(InputAssemblies)" LibraryPath="$(OutputPath)" KeyFile="$(AssemblyOriginatorKeyFile)" OutputFile="$(OutputPath)$(AssemblyName).dll" />
</Target>
<Target
AfterTargets="AfterBuild"
Name="CleanReferenceCopyLocalPaths">
<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>
</Project>
<!-- /ILRepack --> |
I've modified it as you specified, and again it still does the merge, but leaves the satellite dll files there.
I'm so sorry to bother you with this, I had hoped it was something simple. Also do you have a Patreon / PayPal or donation page. I'd like to donate. |
Is it possible that this line, only deletes the files in the output directory and not any subdirectories created from the build?
And do these lines, only delete Empty Directories?
|
I modified the Targets to add some logging, and it appears as though the ReferenceCopyLocalPaths is empty, and the CleanReferenceCopyLocalPaths still isn't being called.
|
I solved the problem by only using a single Then the code you already had, deleted the folders because they were now empty.
|
That's great but maybe language satellite assemblies won't work when merged. You have to embed them first then run the merger. I opened the issue about this on original project. You can see it from here. I usually embed satellite assemblies using Resource.Embedder before merging them. |
You were correct, by the way, about the merged satellite assemblies not working. The English resource was fine, because it is the main dll, but all the other languages were not found, using the ILRepacked assembly. Thank you @ravibpatel so much! The Resource.Embedder worked flawlessly and with very little effort. I really appreciate the time you took to help me with this issue. Have a good day! |
I'm not able to get the CleanReferenceCopyLocalPaths Target to happen. I've enabled verbose logging, and don't see anything related to it.
I've setup both a ILRepack.Config.props file and an ILRepack.targets file within my Project.
Here is my targets file:
And here is my props file:
I'm hoping it would delete all of the satelite assemblies in the language subfolders shown above. But they appear to still all be there.
It merges all of the correct DLLs but does not cleanup the source .dlls. Could anyone help me?
The text was updated successfully, but these errors were encountered: