il-repack
il-repack copied to clipboard
Replacing ilmerge with ilrepack when publishing web applications
From the documentation I understand il-repack is created to replace il-merge. We would like to replace it, but I don't understand how. We currently use a publish profile to publish our asp.net web application. This publish profile is used by msbuild to deploy our website, with a command something like:
msbuild.exe ourprojectfile.csproj /p:DeployOnBuild=true /p:PublishProfile="publishprofile.xml"
the publish profile contains options like this:
<WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption> <UseMerge>True</UseMerge>
to enable merging the output assemblies of the precompile. However, msbuild uses ilmerge.exe by default to do this. What can i do to tell msbuild to use il-repack?
@PaulVrugt I think the ASP precompilation doesn't have anything to do with assembly merging, does it?
I tried looking about those two flags, the most relevant thing is some apparently 3rd party library. Do you have an example project and/or link to what kind of feature you are using?
@timotei
If you take a look at the image below, you can select merge options in the advanced precompile settings. When you enable merging, asp.net will use the aspnet_merge.exe tool to merge assemblies. This is based on ILMerge, which is replaced (as far as i understand) by il-repack. I'd like to know if we can do anything to use il-repack instead of aspnet_merge, because aspnet_merge is painfully slow (runs about 20 minutes for a large web application).
You'll need to know some MSBuild to be able to write this logic. Here's an example: https://github.com/xunit/xunit/blob/cf9d8bb2a2dc83e8d34e7f17872d6c1b11ba9451/src/Directory.Build.targets#L37-L76
Here's how ILRepack itself uses itself to repack itself: https://github.com/gluck/il-repack/blob/5b55fa2f4d7c7b18ffb104e2fade2f794f4ccedf/ILRepack/ILRepack.csproj#L38-L67